<?php
function test($n){
echo $n.' ';
if($n>0){
test($n-1);//自己内部调用自己,即 递归函数
}else{
echo '<-->';
}
echo $n.' ';
}
test(3);
/*
* 死循环了,所以在使用递归的时候要注意避免这种情况!
function test($n){
echo $n.' ';
test($n-1);
}
test(3);
*/
?>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!