php array_walk

PHP array_walk() 函数

对数组中的每个元素应用用户自定义函数:

<?php
function myfunction($value,$key)
{
echo "The key $key has the value $value<br>";
}
$a=array("a"=>"red","b"=>"green","c"=>"blue");
array_walk($a,"myfunction");
?>

  

原文地址:https://www.cnblogs.com/saonian/p/5311592.html