PHP removes the specified value from the array? & Lt ;? Php? // One-dimensional array? Simple practice? Unset ($ arr [array_search ($ value, $ arr)])? $ Arr = array ("a", "B", "c", "d ");? FunctionisHave ($ var ){?? If PHP removes the specified value from the array
?
// One-dimensional array
?
Simple practice? Unset ($ arr [array_search ($ value, $ arr)])
?
?
$ Arr = array ("a", "B", "c", "d ");?
Function isHave ($ var ){?
? If ($ var! = "B ")?
? Return true ;?
}?
$ Arr_filter = array_values (array_filter ($ arr, "isHave "));?
// Print_r ($ arr_filter );?
?
While ($ folder = current ($ folders )){?
? ? If ($ folder ==$ cur_folder ){?
? ? ? ? $ Kv = key ($ folders );?
? ? ? ? Unset ($ folders [$ kv]);?
? ? }?
? ? Next ($ folders );?
}? ? ? ??
?
// Two-dimensional array?
Function killarray (& $ a, $ B, $ c ){?
? ? Foreach ($ a as $ key => $ value ){?
? ? ? ? If (isset ($ value [$ B]) & ($ value [$ B] = $ c )){?
? ? ? ? ? ? Unset ($ a [$ key]);?
? ? ? ? }?
? ? }?
}?
$ A = array ('id' => 1, 'num' => 10, 'type' => 'news'), array ('id' => 2, 'num' => 100, 'type' => 'Pic '));?
$ B = "id ";?
$ C = "1 ";?
Killarray ($ a, $ B, $ c );?
Print_r ($ );??
?