The old superglobals

March 29th, 2005. Tagged: PHP certification

Prior to php 4.1. there were no $_POST, $_GET, etc. superglobal arrays, but there were a bunch of other superglobals, like $HTTP_POST_VARS, $HTTP_GET_VARS and so on.
The guide mentions this in the forms chapter but there is a typo (repeated several times :) ) so I thought I should mention it.

The guide talks about these older vars with an underscore before the name, like $_HTTP_POST_VARS, $_HTTP_GET_VARS and so on which is not true. The correct names are $HTTP_POST_VARS, $HTTP_POST_VARS and so on, without the underscores.

BTW, a trick if you want use old code, written prior to 4.1.0. on newer php versions is to use something like:
< ?php
$_GET = &$HTTP_GET_VARS;
$_POST = &$HTTP_POST_VARS;
$_SERVER = &$HTTP_SERVER_VARS;
?>

Tell your friends about this post: Facebook, Twitter, Google+

Leave a Reply