Re: BUG in recursion

From: Date: Sun, 31 Mar 2002 00:04:32 +0000
Subject: Re: BUG in recursion
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-90823@lists.php.net to get a copy of this message
No it's right. Because $count will equal 10 and it'll print it out, the test will fail and then it'll trace the recursion back and print the j's. It would be a bug if it printed an 11, but it's right the way it is. Dave "Uros Gruber" <uros.gruber@sir-mag.com> wrote in message news:195656991844.20020331005929@sir-mag.com... > Hi! > > This is a code > > function Test() > { > static $count = 0; > > $count++; > echo $count; > if ($count < 10) { > Test (); > } > echo "j"; > } > test(); > > Output is > > 12345678910jjjjjjjjjj > > Why is there 10 j at the and. If this would work it can be > only one. If $count is grater than 10 it does not call itself > but end. Is this maybe a bug or what. > > > -- > lp, > Uros mailto:uros.gruber@sir-mag.com >

« previous php.general (#90823) next »