Re: Returning result from recursive function

From: Date: Thu, 03 Aug 2000 15:29:14 +0000
Subject: Re: Returning result from recursive function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-9956@lists.php.net to get a copy of this message
Hi Dion, return $var should work, it has for me in the past! Not to insult: remember that with recursive functions "return $var';" may be returned to itself and so on and so on. try to make sure that you are saying something like "$var = recursiveFunction(); return $var;" this way you can assign the returned data and return that. If this doesn't help put up a snippet of your code and maybe we'll get a better idea of where the problem lies. Hope that helps! Colin On Thu, 3 Aug 2000, Dion Vansevenant wrote: > How can I return a result to the main code from within a recursive function? > Just using "return $var;" in the code does not work? Should I define the > variable as global and then return the value, or is there a better way to > accomplsih this? > > Thanks. > > Dion > > ************************************************************************* > * Dion Vansevenant * > * Systems & Technology Analyst dion.vansevenant@rowecom.ca * > * RoweCom Canada Tel: (519) 472-1005 * > * P.O. Box 2382 Fax: (519) 472-1072 * > * London, ON N6A 5A7 www.rowecom.ca * > * Canada * > ************************************************************************* > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#9956) next »