note 65562 added to language.variables.predefined
| From: | shylauda69 at yahoo dot com | Date: | Wed, 03 May 2006 14:58:52 +0000 |
| Subject: | note 65562 added to language.variables.predefined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-110452@lists.php.net to get a copy of this message | ||
if some developers still insist in supporting php versions of <4.1, you can use this for
getting/setting superglobal variables.
<?php
function getG ( $var ) {
global $HTTP_GET_VARS;
if ( isset ( $_GET[$var] ) ) {
return $_GET[$var];
}
elseif ( isset ( $_GET[$var] ) ) {
return $HTTP_GET_VARS[$var];
}
else {
return FALSE;
}
}
?>
the same thing for POST, ENV, SERVER, COOKIES..
thus you dont need to call the created "superglobals" (by $_GET &= $HTTP_GET_VARS)
using "global" keyword in every function that uses them and you can even perform any
appropriate actions on the variable before its returned.
----
Server IP: 62.65.181.66
Probable Submitter: 193.58.192.87
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.variables.predefined.php
Edit -- http://master.php.net/note/edit/65562
Del: integrated -- http://master.php.net/note/delete/65562/integrated
Del: useless -- http://master.php.net/note/delete/65562/useless
Del: bad code -- http://master.php.net/note/delete/65562/bad+code
Del: spam -- http://master.php.net/note/delete/65562/spam
Del: non-english -- http://master.php.net/note/delete/65562/non-english
Del: in docs -- http://master.php.net/note/delete/65562/in+docs
Del: other reasons-- http://master.php.net/note/delete/65562
Reject -- http://master.php.net/note/reject/65562
Search -- http://master.php.net/manage/user-notes.php