PHP coding style: variable scope

From: Date: Sat, 11 Nov 2000 13:28:17 +0000
Subject: PHP coding style: variable scope
Groups: php.general 
Request: Send a blank email to php-general+get-24779@lists.php.net to get a copy of this message
Hi, I'm looking for some general advice on coding style, concerning the use of variables in functions. I can see three ways of allowing functions to change variables outside thier normal scope: 1. use "global" in the function: "global $var;" 2. pass the varible to the function by reference: function function_name(&$var) {} 3. use the GLOBALS[] array: $GLOBALS["var"] Which of these is considered best PHP style/most optimised? Regards Dale Robinson

« previous php.general (#24779) next »