参数 | 描述 |
---|---|
array | 必需。规定数组。 |
function | 必需。用户自定义函数的名称。 |
userdata | 可选。用户输入的值,可作为回调函数的参数。 |
<?php function myfunction($value,$key) { echo "The key $key has the value $value<br />"; } $a1=array("a"=>"Cat","b"=>"Dog"); $a2=array($a1,"1"=>"Bird","2"=>"Horse"); array_walk_recursive($a2,"myfunction"); ?>
输出:
The key a has the value Cat The key b has the value Dog The key 1 has the value Bird The key 2 has the value Horse
制作:
http://www.7di.net 生活网搜集整理 参考: http://www.w3school.com.cn/php/func_array_walk_recursive.asp |