exit()==die()将退出,他后面的代码当然无法执行你可能在某个细节出了问题。下面是我的代码,执行正常//----------------------------------------------------
function a($x,$y) {b($x,$y);
echo "ok";
return true;
}function b($x,$y)
{
if($x>1)
{
$x--;
echo "<br>".$x;
b($x,$y); }
return true;
}
a(4,6);
输出:
3
2
1ok
function a($x,$y) {b($x,$y);
echo "ok";
return true;
}function b($x,$y)
{
if($x>1)
{
$x--;
echo "<br>".$x;
b($x,$y); }
return true;
}
a(4,6);
输出:
3
2
1ok
可能还是你的算法有问题<?
class test {
function a($x,$y) {
$this->b($x,$y);
echo "ok";
return true;
}
function b($x,$y) {
echo "x=$x<br>";
if($x){
$x1 = $x-1;
$this->b($x1,$y);
}
else return true;
}
};
$obj = new test;
$obj->a(100,5); //在我的机器上,$x=3000 都没问题
?>
{
if ($num_arg>0)
{
print ("counting down (first) from $num_arg<br>");
countdown_second($num_arg-1);
}
}
function countdown_second ($num_arg)
{
if ($num_arg>0)
{
print ("counting down (second) from $num_arg<br>");
countdown_first($num_arg-1);
}
}
countdown_first(5);给你你喜欢玩几次就玩几次.这是一个互相调用的递归.
我试了一个10000没有问题.