Re: Problems with globals...

From: Date: Tue, 25 Jul 2000 16:02:04 +0000
Subject: Re: Problems with globals...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-8073@lists.php.net to get a copy of this message
Chris: "Boget, Chris" wrote: > > Consider the following code: > > function stringsToLower( $stringsArray ) { > for( $elNum = 0; $elNum < count( $stringsArray ); $elNum++ ) { > > $stringVariable = $stringsArray[$elNum]; > > global $stringVariable; > > $stringVariable = strtolower( $$stringVariable ); > > } > } Place the "global $stringVariable;" statement just below the function call, not in the for loop. --Dan -- 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 More than just answers. Solutions. (SM) http://www.analysisandsolutions.com/ 4015 7 Av #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.general (#8073) next »