I believe you use globals $var to ACCESS a global variable, not to
define.
If I understand correctly, and please correct me if I am wrong, this a
way to ge around the name space...
ex. for something like
$my_var = 10;
function test () {
$my_var = 15;
}
because of these variables are in a different name space, they are not
the same.
If you intended to change the first variable, then you should do
something like
function test() {
globals $my_var;
$my_var = 15;
}
This would change the value of $my_var from 10 to 15.
Please correct me, if I'm wrong.
__________John Monfort_________________
_+-----------------------------------+_
P E P I E D E S I G N S
www.pepiedesigns.com
"The world is waiting, are you ready?"
-+___________________________________+-
On Wed, 14 Feb 2001, Christian Dechery wrote:
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]