www.devguides.com | The developers choice   

 
Technologies available 
    Apache (1)
    ASP (0)
    ASP.NET (0)
    C&C++ (1)
    Google (1)
    HTML (1)
    Java (0)
    JavaScript (1)
    PERL (0)
    PHP (3)
    Unix (0)
    Visual Basic (0)
    XML (0)

Databases 
    MySQL (0)
    Oracle (0)
    PostgreSQL (0)
    SQL Server (1)

Security against 
    Backdoors (0)
    Malicious Mobile Code (0)
    Trojan Horses (0)
    Viruses (0)
    Vulnerabilities (0)

 
 You are currently reading

Introduction to PHP variables Part 2.
posted by Andres @ 02:23 AM | Sunday, May 09, 2004
Explanations for predefined variables, variables references, variables determination functions, forcing variables. Everything you need to understand for PHP variables management.


 The article requested:
PHP variables Continued
We've covered some part of PHP variables and it's time to move on for more about them. PHP also has predefined variables that are available for programming purposes such as communicating between the client and server, forms interactions, etc. Let's get to it.

Predefined variables
PHP comes with built-in predefined variables informing us about configurations, user unput and a lot more. The values for each of the predefined variables are not always the same because their values depend on your server configuration and other factors. These variables are superglobals, therefore, they can be used in every scope of your script. I'll explain about variable scopes in the future, for now you just need to have a good understanding about the variables in PHP.

Let's have a look now at each of the predefined variables:
  • $GLOBALS
    This holds every variable that is within the global scope of a php script.
  • $_SERVER
    This holds every value generated by the webserver or the script being executed.
  • $_GET
    This holds every variable defined by you in a form, $_GET normally holds user input through the URL. e.g. (index.php?name=andres&lastname=robalino)
  • $_POST
    Holds every variable through forms too, the difference between $_GET and $_POST is that $_POST holds user input from the post method which is more secure when dealing with users and passwords.
  • $_COOKIE
    You probably heard of the word cookies, this holds every cookie that the server has sent to your computer.
  • $_FILES
    Holds values from the HTTP post file uploads.
  • $_ENV
    Values that provide you with the Environment of the script
  • $_REQUEST
    It holds variables of user input and cookies as well, this isn't secure, it's better to use the $_POST, $_GET, $_COOKIE for security reasons.
  • $_SESSION
    Holds every variable inside a session, when you view a website and you interact with the website, a session is currently active.
[1][2][3][4][Determining variables type]


Copyright ©2004 Andrab, Inc. All rights reserved.