It's somewhat annoying to have to tell the function which variables are
global sometimes but overall it makes it easier to avoid stupid
mistakes. It is a good push to make me less prone to making things
global. Usually I just avoid using globals and then pack what I do use
into appropiate arrays and thus save myself most the hassle. In several
thousand lines of code I may have one or two global vars called.
Boget, Chris wrote:
>>> Yes. But with regards to form variables, all you need to do is
>>> make one variable global:
>>> $HTTP_POST_VARS
>>> it is an associative array that contains all the post variables from
>>> the form. Make it global and just loop through it.
>>
>> exactly, u need to loop to an array to get the globals u want.
>
>
> No, to the the variables/values that you want.
>
>> this is not the idea of global, global is global... if it's set outside
>> of ALL functions it should be available 'with no extra code'
>> to ALL functions, it works that way in all programming language
>> I'm familiar with... why not in PHP? that's what I wanna know,
>> why globals in PHP doesn't really work like globals?
>
>
> Perhaps I'm missing something. In order to access the value of any
> variable defined outside the scope of the function, you have to declare
> it as "global". This is true in every single instance. If you do not, then
> you cannot access the value of that variable. While it's been a while
> since I've worked with C, I seem to recall it being the case there as
> well. And in Pascal. And in VB. Again, it's been a while so I could be
> wrong (but don't think so).
> Also, PHP was written in C. Why would they institute a behaviour
> that was radically different than what is part of the parent language?
>
> Chris
>
--
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]