Functions: Variable Scope
If you create a variable in the global scope (in main script, outside of a function) then the value of that variable is not available within the function unless passed to it trough constants, arguments or using superglobals.
List of Superglobal’s
$_GET - receaves data sent to php via script url (?page=1)
$_POST - receaves data sent to php via posting form
$_FILES - receaves data from post file uploads
$_COOKIE - receaves data sent to PHP via HTTP cookies
$_REQUEST - receaves data sent via $_COOKIE,$_POST and $_GET
$_SESSION - receaves data avaliable from previosly stored session
$_SERVER - receaves server information
$_ENV - receaves data avaliable from the PHP environment
and the use of global or $GLOBALS['variable']
(more…)











