RE: [PHP] PHP globals aren't really globals

From: Date: Fri, 16 Feb 2001 03:18:27 +0000
Subject: RE: [PHP] PHP globals aren't really globals
Groups: php.general 
Request: Send a blank email to php-general+get-40069@lists.php.net to get a copy of this message
I never used 50 of them, but I think there's such a thing as 'register globals' wchich makes all if the globals become available inside your funcs...... no idea how to use it ... I feel like I've seen it in someone else's code ... correct me if I am wrong ... Cheers, Maxim Maletsky -----Original Message----- From: Christian Dechery [mailto:lemming@vento.com.br] Sent: Wednesday, February 14, 2001 11:25 PM To: php-general@lists.php.net Subject: [PHP] PHP globals aren't really globals I've been programming in C all my life, and now I just started developing in PHP and I'm really enjoying it, it has all the missing improvements that C needed to be more user-likely. But one thin I can't get, how can PHP call a variabel global, if it isn't global. A global var, is a var defined outside all functions and it's available to all and altered by all, without having to redefine or call the var again. In PHP, for a var to be global you have to add a 'global $var' inside the function u want to use it. THis is not nice, what about if u have a form with 50 fields and want a function to validate all of them, u have to pass them all to the function or build a little piece of code to make all th $GLOBALS local right? Is this really the idea of global vars? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#40069) next »