Re: Nested functions and stackoverflow

From: Date: Thu, 14 Dec 2000 16:46:05 +0000
Subject: Re: Nested functions and stackoverflow
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30315@lists.php.net to get a copy of this message
Sire: > In a php-function, say "func()", I "include()" a php-file, say > "hello1.php". > Inside "hello1.php" I initialize a variable, say "$var" and create a > link to another php-file, say "hello2.php". > In "hello2.php" I check for the existence of "$var" and calls the > function "func()" if it exists. > > Here is the problem: > If the user follows the link to "hello2.php" the function func() has in > practice been called inside itself. Uh not in this example you presented. If someone goes directly to hello2.php, there's nothing there that calls hello1.php. So, $var will not be set, because $var is set in hello1.php. Thus, func() won't execute because you said it should not execute if $var doesn't exist. As far as calling a function from inside itslef, that's just fine. What happens depends on how you've coded the function and your system limitations. You can halt execution via an exit() statement when certain conditions have been met. If things don't stop from your instructions in the code, they can run into system limits such as maximum execution time or memory allocation. Perhaps some of the folks directly involved with PHP development have further insights. Enjoy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.general (#30315) next »