Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

very simple question

Status
Not open for further replies.

alan123

MIS
Oct 17, 2002
149
0
0
US
I want to know what is the difference between:
$HTTP_COOKIE_VARS['USERNAME'];
and
$_COOKIE['USERNAME'];

Can I use either one in the php code?

thanks
 
It has to do with the naming of these superglobal arrays.
In version 4.1.0 the naming scheme changed. Before it used to be $HTTP_POST_VARS and it was abbreviated to $_POST
The same is true for COOKIE, SERVER, etc.
 
As an addendum to DRJ478's post...

The so-called "long-named" arrays, $HTTP_[POST|GET|COOKIE|SERVER]_VARS, were never superglobal. They were merely global arrays.

The so-called "short-named" arrasy, $_[POST|GET|COOKIE|SERVER], are superglobal. They are available everywhere, even inside user-defined functions. The "long" arrays required the use of the global scoping operator.

With the advent of PHP 5, it is optional whether the "long-named" arrays will even be instantiated. The recommended php.ini file that ships with the PHP 5 source tarball has it turned off.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top