>The idea is to avoid really nasty scope-related bugs that are common in
>C
>code that uses lots of global variables.  Years and years ago when I wrote
>the first version of PHP I was working for a telco writing software for
>a
>large telephone switch.  The code was huge and extremely ugly.  Global
>variables everywhere.  The team had been chasing a bug for about a week
>when I got stubborn and decided it was time to kill the bug.  I printed
>out all the source code and laid it out in a long hallway as I crawled
>along with different coloured pens and manually traced my way through it
>as none of the debuggers we had at the time were of any use.  After
>countless hours the bug turned out to be inside a function that silently
>modified a global variable which affected another piece of code in a
>completely different part of the program.
>
>I swore I would not have the same problem in PHP and thus the requirement
>for people to be explicit about using global variables inside functions.
>Hopefully it also forces a little bit of structure and organization on
>people.

thanks...
now I have an answer I can swallow... cuz I simply didn't get why PHP (which
came from C) had a differente behaviour according to globals.
I never had any problem handling them, but in the other hand I never had
50 of them in a program.
I can understand that making global every single form variable would take
a whole lot of control by the compiler...

I just came with a nice foreach() to make my globals local, and I have to
put them in ALL my functions that handles form vars... I'll consider using
arrays in my next forms....

but hey, don't worry... PHP really kicks ASP ass in all matters! :)

cya


. [ 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]

Reply via email to