0
如何在類中模擬PHP4中的以下行爲。array_walk_recursive PHP4
$sample = array('dog' => 'woof', 'cat' => array('angry' => 'hiss', 'happy' => 'purr'), 'aardvark' => 'kssksskss');
$output = array();
// Push all $val onto $output.
array_walk_recursive($sample, create_function('$val, $key, $obj', 'array_push($obj, $val);'), &output);
print_r($output);
/*
* Array
* (
* [0] => woof
* [1] => hiss
* [2] => purr
* [3] => kssksskss
*)
*/
沒有理由再使用PHP4了。 – ThiefMaster 2011-03-21 16:02:54