php best tutorial-php variables

PHP automatically creates variables for all the data it receives in an HTTP request. This can include GET data, POST data, cookie data, and environment variables. The variables are either in PHP's global symbol table or in one of a number of superglobal arrays, depending on the value of the register_globals setting in your php.ini file. 
 
 
$_GET
GET-method variables. These are the variables supplied directly in the URL. For example, with http://www.test.com/page.php?a=21&b=22, $_GET['a'] and $_GET['b'] are set to 21 and 22, respectively.
$_POST
POST-method variables. Form field data from regular POST-method forms.
$_COOKIE
Any cookies the browser sends end up in this array. The name of the cookie is the key and the cookie value becomes the array value.
$_REQUEST
This array contains all of these variables (i.e., GET, POST, and cookie). If a variable appears in multiple sources, the order in which they are imported into $_REQUEST is given by the setting of the variables_order php.ini directive. The default is 'GPC', which means GET-method variables are imported first, then POST-method variables (overriding any GET-method variables of the same name), and finally cookie variables (overriding the other two).
$_SERVER
These are variables set by your web server. Traditionally things like DOCUMENT_ROOT, REMOTE_ADDR, REMOTE_PORT, SERVER_NAME, SERVER_PORT, and many others. To get a full list, have a look at your phpinfo( ) output, or run a script like the following to have a look:
<?php
  foreach($_SERVER as $key=>$val) {
    echo '$_SERVER['.$key."] = $val<br>\n";
  }
?>
$_ENV
Any environment variables that were set when you started your web server are available in this array.
Related Posts:
  • All Operators Of PHP   All PHP Operators  An expression is the basic building block of the language. Anything with a value can be thought of as an expression. Examples include: 5 5+5 $a $a==5 sqrt(9) By combining many of these bas… Read More
  • Variables in PHP Variables in PHP Variables are used for storing a values, like text strings, numbers or arrays. When a variable is set it can be used over and over again in your script All variables in PHP start with a $ sign symbol. Th… Read More
  • Rewriting Keyword-Rich URLs rules for your .htaccess file Modify the .htaccessfile in your seophpfolder like this: RewriteEngine On # Rewrite numeric URLs RewriteRule ^Products/C([0-9]*)/P([0-9]*)\.html$ i /product.php?category_id=$1&product_id=$2… Read More
  • PHP File Upload Script PHP File Uploading Code Take a moment to commit the following list to memory— it contains the variables that are automatically placed in the  $_FILES superglobal after a successful file upload.  The base of im… Read More
  • PHP Sessions - setcookie mplement a session timeout of your own.  Both options mentioned by others session.gc_maxlifetime  and session.cookie_lifetime are not reliable. session.gc_maxlifetime session.gc_maxlifetime specifies the number o… Read More
  • PHP isn’t as easy as working with JSON <?php $list = array( "eggs", "bread", "milk", "bananas", "bacon", "cheese" ); $xml = new SimpleXMLElement("<list />"); foreach($list as $item) { $xml->addChild("item", $item); } // for nice output $dom = dom_impo… Read More
  • PHP method of securely Tips PHP method of securely website PHP Web security tips Passwords used within your PHP application  should always be encrypted. If the server you are using does not support mcrypt(), use crypt() to encrypt the password… Read More
  • php-best top 20 Open Source Content Management Systems best top 20 php Open Source Content Management Systems php-best top 20 Open Source Content Management Systems All this open source content management system written in PHP/mySQL and well configured themes and modules for … Read More
  • How to Sending Data to a Database php How to Sending Data to a Database php Save Data to a Database by php The process of adding information to a table is similar  to creating the table itself in terms of which functions  you use, but the SQL quer… Read More
  • PHP Interview Questions with Answers-part1    What is PHP?     PHP is a server side scripting language  used for web development applications.     Php is the powerful tool for making dynamic website.     Ma… Read More
  • Top PHP Interview Questions with Answers For Job   What is PHP?     PHP is a server side scripting language  used for web development applications.     Php is the powerful tool for making dynamic website.     Many … Read More
  • PHP Array Introduction Function Description PHP  Testing Array and sizeof( )<?php$fixture = Array( );// $fixture is expected to be empty.$fixture[] = "element";// $fixture is expected to contain one element.?>A really simple way … Read More
  • Top PHP Tutorial website PHP - Wikipedia, the free encyclopedia PHP is a server-side scripting language designed for  web development but also used as a general-purpose programming language. As of January 2013, PHP was installed on ... http… Read More
  • Creating a Php Script to Mail Your Form Php Mail Script According to the form action in simple_form.html, you  need a script called send_simpleform.php. The goal  of this script is to accept the text in  $_POST[sender_name], $_POST[sender_email],… Read More
  • php Sessions code Php Sessions Sessions are used to help maintain the values of variables across multiple web pages. This is done by creating a unique  session ID that is sent to the client browser. The browser  then sends the … Read More