Home > Backend Development > PHP Tutorial > 关于array_walk的有关问题

关于array_walk的有关问题

WBOY
Release: 2016-06-13 12:31:58
Original
757 people have browsed it

关于array_walk的问题
$fruits = array("d"=>"lemon","a"=>"apple","b"=>"banana","c"=>"orange");
function test_alter(&$item1,$key,$prefix)
{
$item1 = "$prefix:$item1";
}
function test_print($item2,$key)
{
echo "$key.$item2
 \n";
}
echo "Before.....\n";
array_walk($fruits, 'test_print');
array_walk($fruits, 'test_alter','fruit');
echo "...and after:\n";
array_walk($fruits,'test_print');
?>
关于这段代码的 最后几行的遍历 表示理解不能  求大大们帮我细细的分析一下 让我理解~

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template