Home > Article > Backend Development > PHP function recursive call example_PHP tutorial
function arrContentReplact($array)
{
if(is_array($array))
{
foreach($array as $k => $v)
{
$array[$k] = arrContentReplact($array[$k]);
}
}else
{
$array = str_replace(
array('<', '>'),
array('{', '}'),
$array
);
}
return $array;
}
$arr = array(array("< 小刚>","< 小晓>",array("<小强>",array("<浪人>"))),"< 小飞>","< 小李>","< 小红>");
$arr3 = arrContentReplact($arr);
echo "
";<br>print_r($arr3);<br>echo "";
作者:k7gxn56