PHP Syntax Variables Scope Superglobal $_GET

 

- Info:

- $_GET superglobal array contains information parameters passed using the GET method.

- You cannot reference GET variables directly like: $cat, $id.

 

- Example:

- Create PHP Console Application Test.php.

 

Test.php

<?php

//SOME VARIABLES FROM _GET.

//http://www.example.com/index.html?cat=apache&id=157

$_GET['cat'] = "apache";

$_GET['id'] = "157";

//LIST ALL VARIABLES FROM SUPERGLOBAL ARRAY _GET.

foreach ($_GET as $var => $value) {

echo "$var => $value \n";

}

?>