Re: Suggestion: global variables being accessed in localscope

From: Date: Fri, 09 Feb 2007 01:43:28 +0000
Subject: Re: Suggestion: global variables being accessed in localscope
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-27932@lists.php.net to get a copy of this message
Guilherme Blanco wrote:
Brian,I am sorry about the message indentation... Seems PHP-Internals list does not like M$ Live(r) Mail!
Please use plain text mail as your messages are a PITA to read, thanks.
you can see, the only change needed is in a throw-able error (Undefined variable), which does a second look-up in the symbolTable.Doing this, you do not need to use $GLOBALS nevermore! And also, global can
You didn't grasp two of the major PHP features (not bugs!): 1. Every variable you access inside a function is local unless explicitely imported (through $GLOBALS, global or superglobals) from the global scope. 2. Accessing undefined variables is normal and not an error (not everybody agrees here but lots of people consider this a big plus). Changing this would turn PHP into a completely different language so it's simply not going to happen. If you don't like these basic concepts it's probably a good idea to switch language. Regards, - Chris

« previous php.internals (#27932) next »