array_walk ( $array, $funcname [, $parameter] );
此函数返回一个数组,其中包含所有参数array2、array3中存在的array1的所有值。
Sr.No | Parameter & Description |
---|---|
1 |
array(必需) 它指定一个数组。 |
2 |
funcname(必需) 用户自定义函数的名称。 链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-array-walk.html 来源:LearnFk无涯教程网 |
3 |
parameter(可选) 它为用户自定义函数指定一个参数。 |
<?php function call_back_function($value,$key) { echo "The key $key has the value $value\n"; } $input=array("a"=>"green", "b"=>"brown", "c"=>"blue", "red"); array_walk($input,"call_back_function"); ?>
这将产生以下结果-
The key a has the value green The key b has the value brown The key c has the value blue The key 0 has the value red
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)