View Full Version : $http_post_vars - ??

Jon W
01-04-2008, 11:25 PM
What does $HTTP_POST_VARS mean, and what does it do?

Jon W

01-04-2008, 11:47 PM
It shouldn't be used anymore. It has been deprecated since 4.1.0 in favor of $_POST:

From http://us2.php.net/reserved.variables:

An associative array of variables passed to the current script via the HTTP POST method. Automatically global in any scope.

This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_POST; to access it within functions or methods, as you do with $HTTP_POST_VARS.

$HTTP_POST_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_POST_VARS and $_POST are different variables and that PHP handles them as such)

If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_POST and $HTTP_POST_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not superglobals.