此代码是不言自明的。在我调用该函数并且它工作正常后,其他调用将失败:
<?php
function htmlFilter_array(&$html_array)
{
function nested_clean(&$value)
{
$value = htmlentities($value, ENT_QUOTES, "UTF-8");
}
array_walk_recursive($html_array, 'nested_clean');
}
$arr1=array("id"=>"1");
echo "line 1 <br/>";
$arr2=array("id"=>"2");
echo "line 2 <br/>";
$arr3=array("id"=>"3");
echo "line 3 <br/>";
htmlFilter_array($arr1);
echo "line 4 <br/>";
htmlFilter_array($arr2);
echo "line 5 <br/>";
htmlFilter_array($arr3);
echo "line 6 <br/>";
?>
这是结果:
line 1
line 2
line 3
line 4
为什么第 5 行和第 6 行无法运行?