Home > Backend Development > PHP Tutorial > PHP function recursive call example_PHP tutorial

PHP function recursive call example_PHP tutorial

WBOY
Release: 2016-07-21 14:54:11
Original
1115 people have browsed it


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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/364658.htmlTechArticle?php function arrContentReplact($array) { if(is_array($array)) { foreach($array as $k = $v) { $array[$k] = arrContentReplact($array[$k]); } }else { $array = str_replace( array('',...
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