the first,i write a small program like this <?php function a(){ echo "test"; a(); } a(); ?> PHP: i think my computer(yes,i run this script in my local computer)would be too busy to finish it.but im wrong,the browse auto disconnect.why the program would not go on?? thank you.
As stated above, the code would never finish running because you're calling the same function in the function itself. With a little bit of logic, you'll why it never ends. If you just want to call it once within itself, use a static variable inside it which counts the times it's been executed, and only call it again if this certain amount you specify hasn't been passed.
I think he's actually asking "this should go on forever but it doesn't... why not?" I could be wrong but that's the way I read it and OP the answer is because PHP has a max_execution_time setting that is designed to stop exactly this type of script. You can always try and override it with a call to set_time_limit(0);
hehe,ur right.im new in PHP. in face,when i run this scirpt in my computer,the browse would disconnect automatic.its very interesting.i think there is a system in php,which can stop this recursive loop.And i try to use some php script to make my computer crazy.