Learn PHP

reserved variable get $_GET


$_GET -- $HTTP_GET_VARS [deprecated] — HTTP GET variables

An associative array of variables passed to the current script via the URL parameters (aka. query string). Note that the array is not only populated for GET requests, but rather for all requests with a query string.

$HTTP_GET_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_GET_VARS and $_GET are different variables and that PHP handles them as such)

				echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!';

Note: This is a 'superglobal', or automatic global, variable. 
		   This simply means that it is available in all scopes throughout a script. There is no need to do 
		 global $variable; to access it within functions or methods.

Note: The GET variables are passed through urldecode().

				// Smart GET function
				public function GET($name=NULL, $value=false, $option="default")
				    $option=false; // Old version depricated part
				    $content=(!empty($_GET[$name]) ? trim($_GET[$name]) : (!empty($value) && !is_array($value) ? trim($value) : false));
				        return preg_replace("@([^0-9])@Ui", "", $content);
				    else if(is_bool($content))
				        return ($content?true:false);
				    else if(is_float($content))
				        return preg_replace("@([^0-9\,\.\+\-])@Ui", "", $content);
				    else if(is_string($content))
				        if(filter_var ($content, FILTER_VALIDATE_URL))
				            return $content;
				        else if(filter_var ($content, FILTER_VALIDATE_EMAIL))
				            return $content;
				        else if(filter_var ($content, FILTER_VALIDATE_IP))
				            return $content;
				        else if(filter_var ($content, FILTER_VALIDATE_FLOAT))
				            return $content;
				            return preg_replace("@([^a-zA-Z0-9\+\-\_\*\@\$\!\;\.\?\#\:\=\%\/\ ]+)@Ui", "", $content);
				    else false;
				DEFAULT: $_GET['page'];
				SMART: GET('page'); // return value or false if is null or bad input


			    function php_fix_raw_query() {
			        $post = '';
			        // Try globals array
			        if (!$post && isset($_GLOBALS) && isset($_GLOBALS["HTTP_RAW_POST_DATA"]))
			            $post = $_GLOBALS["HTTP_RAW_POST_DATA"];
			        // Try globals variable
			        if (!$post && isset($HTTP_RAW_POST_DATA))
			            $post = $HTTP_RAW_POST_DATA;
			        // Try stream
			        if (!$post) {
			            if (!function_exists('file_get_contents')) {
			                $fp = fopen("php://input", "r");
			                if ($fp) {
			                    $post = '';
			                    while (!feof($fp))
			                    $post = fread($fp, 1024);
			            } else {
			                $post = "" . file_get_contents("php://input");
			        $raw = !empty($_SERVER['QUERY_STRING']) ? sprintf('%s&%s', $_SERVER['QUERY_STRING'], $post) : $post;
			        $arr = array();
			        $pairs = explode('&', $raw);
			        foreach ($pairs as $i) {
			            if (!empty($i)) {
			                list($name, $value) = explode('=', $i, 2);
			                if (isset($arr[$name]) ) {
			                    if (is_array($arr[$name]) ) {
			                        $arr[$name][] = $value;
			                    } else {
			                        $arr[$name] = array($arr[$name], $value);
			                } else {
			                    $arr[$name] = $value;
			        foreach ( $_POST as $key => $value ) {
			            if (is_array($arr[$key]) ) {
			                $_POST[$key] = $arr[$name];
			                $_REQUEST[$key] = $arr[$name];
			        foreach ( $_GET as $key => $value ) {
			            if (is_array($arr[$key]) ) {
			                $_GET[$key] = $arr[$name];
			                $_REQUEST[$key] = $arr[$name];

			    # optionally return result array 
			        return $arr;


PHP Tutorials






Echo and Print Statement

Data Types



Number Convert

PHP String

php variable substitution in string

php string element

php string function

php addcslashes function

php addslashes function

php get magic quotes gpc function

php get meta tags function

php urlencode function

PHP $ and $$ Variables

PHP constant

PHP Magic Constants

PHP Static Variable

PHP Super Globals

PHP Globals

PHP Server

PHP reserved variable get

PHP reserved variable post

PHP reserved variable FILES

PHP reserved variable Cookies

PHP reserved variable Session

PHP reserved variable Request

PHP reserved variable environment

PHP Operator

PHP Arithmetic Operator

PHP Comparison Operator

PHP Incrementing and Decrementing Operators

PHP Identical Operators

PHP Logical Operators

PHP String Operators

PHP Ternary Operators

PHP Execution Operators

PHP Operator Precedence

PHP Array Operator

PHP Class

PHP Class Inheritance

PHP constructor and destructor

PHP abstract class

PHP class access control

PHP statement

PHP If statement

PHP else statement

PHP else if statement

PHP control structure statement

PHP while loop

PHP do while loop

PHP for loop

PHP for each loop

PHP break statement

PHP continue statement

PHP declare statement

PHP return statement

PHP require statement

PHP include

PHP require once

PHP include once

PHP goto statement

PHP function

PHP function parameter

PHP function scope

PHP array

PHP array operator

PHP array element loop

PHP array foreach loop

PHP array multidimensional

PHP html forms

PHP get and post method

form redirect

file inclusion

file i/o