Breaking News
Home / Web / PHP / PHP FAQ / What are the various gobal variables in PHP?

What are the various gobal variables in PHP?

Answer

PHP provides a variety of Globals which are exposed as associative array in the scripts are as follows:

$_GET[‘variable_name’]
– To access data stored in html form fields when form post method “GET”.

$_POST[‘variable_name’]
– To access data stored in html form fields when form post method “POST”.

$_REQUEST[‘variable_name’]
– To access data stored in html form fields for “GET” or “POST” methods.

$_SESSION[‘variable_name’]
– To access data explicitly stored in Session Context

$_COOKIE[‘variable_name’]
– To access data read for a Cookie

$_SERVER[‘variable_name’]
– To access data explicitly stored in Session Context

$_FILES[‘variable_name’]
– To access data elements as part of file upload.

$_ENV[‘variable_name’]
– To access operatting system related data/configuration.<!>

[pb_builder]

Check Also

What is the structure of a PHP Program?

Program Organization is key to readability, ease of debugging, few bugs, simplicity and more. As …

Advertisment ad adsense adlogger