PHP Superglobal Variables and Register_Globals
PHP has a special kind of variable which is called a superglobal. The reason these variables are special is because they are automatically available to any PHP program without the programmer creating or defining them in his program. You can think of them as "built-in" variables. The way you will access these variables differs depending on whether register_globals is turned on or off on your server. Before PHP version 4.2, register_globals was turned on by default. However do to security reasons; this setting is now turned off by default (version 4.2+). Of course it is up to the people who run your server to decide whether to override the default setting and turn register_globals on. The easiest way to test your own server is to use the phpinfo(). You will probably have a link to this webpage in the administrative area of your website. On this webpage you will find the Configuration PHP Core section that has this information. As mentioned above you will access the superglobals differently depending on the setting of your server. For the new server setup the superglobals were given new names. If your server still has the old setting, it would be better to start using the new names anyway. If you use these new names you can be sure that your programs will work under both server configurations. However, this is not the case for the old names. They will only work for the old server configuration. The chart below shows the old and new names and a description of the superglobals. Notice that the names of these superglobals are in all capital letters.
| |||||||||||||||||||||||||||
This site needs an editor - click to learn more!
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map
Content copyright © 2023 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact
BellaOnline Administration
for details.