import_request_variables
import_request_variables
(PHP 4 >= 4.1.0, PHP 5 < 5.4.0)
import_request_variables — Import GET/POST/Cookie variables into the global scope
Description
bool import_request_variables ( string $types [, string $prefix ] )
Imports GET/POST/Cookie variables into the global scope. It is useful if you disabled register_globals, but would like to see some variables in the global scope.
If you're interested in importing other variables into the global scope, such as $_SERVER, consider using extract().
Warning
This function has been DEPRECATED
as of PHP 5.3.0 and REMOVED
as of PHP 5.4.0.
Parameters
types
Using the types
parameter, you can specify which request variables to import. You can use 'G', 'P' and 'C' characters respectively for GET, POST and Cookie. These characters are not case sensitive, so you can also use any combination of 'g', 'p' and 'c'. POST includes the POST uploaded file information.
Note
:Note
that the order of the letters matters, as when using "GP
", the POST variables will overwrite GET variables with the same name. Any other letters thanGP
C are discarded.
prefix
Variable name prefix, prepended before all variable's name imported into the global scope. So if you have a GET value named "userid
", and provide a prefix "_pref__", then you'll get a global variable named $pref_userid
.
Note
: Although theprefix
parameter is optional, you will get anE_NOTICE
level error if you specify noprefix
, or specify an empty string as aprefix
. This is a possible security hazard. Notice level errors are not displayed using the default error reporting level.
Return Values
Returns TRUE
on success or FALSE
on failure.
Examples
Example #1 import
_
request
_
variables() example
<?php
// This will import GET and POST vars
// with an "rvar_" prefix
import_request_variables("gp", "rvar_"
echo $rvar_foo;
?>
See Also
- $_REQUEST
- Predefined Variables
- extract() - Import variables into the current symbol table from an array
← gettype
intval →
© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://secure.php.net/manual/en/function.import-request-variables.php