TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 05-12-2009, 06:25 PM   #1 (permalink)
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
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Defining your World: All About Constants Wildhoney General 15 01-29-2013 12:32 PM
Is there a function to list all "active" variables Dave Absolute Beginners 3 06-05-2008 04:03 AM
assigning pcre replacements ( $1 or $2 or whatever ) to variables Orc General 7 04-21-2008 07:53 PM
When was the last time you used the global construct? Wildhoney The Lounge 11 01-28-2008 08:41 PM
Variables in Regular Expession Wildhoney Advanced PHP Programming 4 12-06-2007 03:44 PM


All times are GMT. The time now is 04:42 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design