Below are the PHP5 SuperGlobals
$GLOBALS: This SuperGlobal Variable is used for accessing globals variables.
<?php
$a = 10;
function foo(){
echo $GLOBALS['a'];
}
//Which will print 10 Global Variable a
?>
$_REQUEST: This SuperGlobal Variable is used to collect data submitted by a HTML Form.
<?php
if(isset($_REQUEST['user'])){
echo $_REQUEST['user'];
}
//This will print value of HTML Field with name=user submitted using POST and/or GET MEthod
?>
$_GET: This SuperGlobal Variable is used to collect data submitted by HTML Form with get
method.
<?php
if(isset($_GET['username'])){
echo $_GET['username'];
}
//This will print value of HTML field with name username submitted using GET Method
?>
$_POST: This SuperGlobal Variable is used to collect data submitted by HTML Form with post
method.
<?php
if(isset($_POST['username'])){
echo $_POST['username'];
}
//This will print value of HTML field with name username submitted using POST Method
?>
$_FILES: This SuperGlobal Variable holds the information of uploaded files via HTTP Post method.
<?php
if($_FILES['picture']){
echo "<pre>";
print_r($_FILES['picture']);
echo "</pre>";
}
/**
This will print details of the File with name picture uploaded via a form with method='post and with enctype='multipart/form-data'
Details includes Name of file, Type of File, temporary file location, error code(if any error occured while uploading the file) and size of file in Bytes.
Eg.
Array
(
[picture] => Array
(
[0] => Array
(
[name] => 400.png
[type] => image/png
[tmp_name] => /tmp/php5Wx0aJ
[error] => 0
[size] => 15726
)
)
)
*/
?>