RE: [PHP-DB] globals

From: Date: Sat, 16 Dec 2000 15:56:04 +0000
Subject: RE: [PHP-DB] globals
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5289@lists.php.net to get a copy of this message
> $myArray; > $myVariable; > doThis($myVariable); > > > function doThis($tempVariable) { > global $myArray; > # do whatever > } Then how wuld I declare the global as the condition of an if? $j = 0; function doThis($tempVariable) { if (global $myArray[$j] == $tempVariable) { echo "whatever"; } $j++; } Thanks, John > -----Original Message----- > From: John Starkey [mailto:jstarkey@advancecreations.com] > Sent: Saturday, December 16, 2000 3:19 AM > To: php-db@lists.php.net > Subject: [PHP-DB] globals > > > Hello all. > > What are the rules for globals? I've seen them in tutorials but have had a > hard time implementing them. I need to create an array outside of a > function, pass a variable to that function, and then call the array for > comparison to that variable. I can't pass the array to the function. > > > Thanks, > > John > > >

« previous php.db (#5289) next »