JRequest::getVar
Fetches and returns a given variable.
The default behaviour is fetching variables depending on the current request method: GET and HEAD will result in returning an entry from $_GET, POST and PUT will result in returning an entry from $_POST. You can force the source by setting the $hash parameter: post $_POST get $_GET files $_FILES cookie $_COOKIE env $_ENV server $_SERVER method via current $_SERVER['REQUEST_METHOD'] default $_REQUEST
Signature
public function getVar(string
$name,
[string
$default = null,
[string
$hash = 'default',
[string
$type = 'none',
[integer
$mask = 0]]]] )
Parameters
-
$name
- Variable name.
-
$default
- Default value if the variable does not exist.
-
$hash
- Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
-
$type
- Return type for the variable, for valid values see {@link JFilterInput::clean()}.
-
$mask
- Filter mask for the variable.
Returns
- mixed
- Requested variable.