View Single Post
Old 05-12-2009, 06:25 PM   #1 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default global variables or not?

Ok so I'm reading a book called PHP 5 Power Programming.


Quote:
PHP does not support global variables like many other programming
languages (except for some special pre-defined variables, which we discuss
later).
He then goes on to say you can access main script variables like so:

$GLOBALS['variable_here'];


I think we all know that. So when someone asks about accessing PHP's global variables, the technical correct answer is NO, PHP does not support it but here's a way to access it within a function....

Is that correct? Kinda confusing....but I get it...


Just want to make sure, because when I take the test, I don't want them asking me, "Does PHP support global variables?"

Then I say, "No".

And the test comes back, "WRONG, you can access it this way: $GLOBALS['variable_here'].."

Which then would mean the test is wrong...
allworknoplay is offline  
Reply With Quote