PHP Recursive call tips to explain _php tutorial

Source: Internet
Author: User
In the actual PHP code, 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? Let's look at a sample code to analyze how to implement this function in detail.

PHP recursive invocation implements a multivariate array substitution function code example:

Copy the Code code as follows:
< PHP
$arr = Array ("< small >", "< Xiao Xiao >"), "< little Fly >", "< Xiao li >", "< Little 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 that readers will be able to use the above PHP recursive call to implement the multivariate array substitution function example code, to understand the specific usage.

http://www.bkjia.com/PHPjc/326591.html www.bkjia.com true http://www.bkjia.com/PHPjc/326591.html techarticle in the actual PHP code, 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 pass a generation ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.