array_walk方法回调函数实例 1. [代码] array_walk 1 ?php 2 $array = array('foo' = 'bar', 'baz' = 'bat'); 3 4 array_walk($array, function($val,$key) use($array){ 5 if ($val == 'bar') { 6 unset($array[$key]); 7 } 8 }); 9 10 var_dump($
1. [代码]array_walk
1 <?php 2 $array = array('foo' => 'bar', 'baz' => 'bat'); 3 4 array_walk($array, function($val,$key) use(&$array){ 5 if ($val == 'bar') { 6 unset($array[$key]); 7 } 8 }); 9 10 var_dump($array); 11 ?>