defining vars within functions as global

From: Date: Fri, 06 Sep 2002 03:52:08 +0000
Subject: defining vars within functions as global
Groups: php.general 
Request: Send a blank email to php-general+get-115395@lists.php.net to get a copy of this message
Hi, I'd like to be able to define multiple variables within a function, and have it available outside the function from the point the function is called... eg: <? function foo() { $foo = "aaa"; $bar = "bbb"; } foo(); echo $foo; echo $bar; ?> How to I specify that $foo and $bar (defined in the func) are to be set globally (ie, outside the function)? I'm aware I could return as array of values, but I'm interested to see if there's another option???? Justin

« previous php.general (#115395) next »