In the actual code of PHP, when we need to implement the multivariate array substitution function, we will encounter PHP recursive call. So what is the specific way to use it? Below we will use a code example to specifically analyze how to implement this functionality.
PHP recursive invocation implements multivariate array substitution function code example:
Copy Code code as follows:
< PHP
$arr = Array ("< small just >", "< Xiao >"), "< small fly >", "< Xiao li >", "< small red >");
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 3 = arrcontentreplact ($arr);
echo "< pre>";
Print_r ($arr 3);
echo "</pre>";
?>
I hope readers will be able to use this PHP recursive call to implement the multivariate array substitution function of the sample code to understand the specific usage.