Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Super Global Variables in PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 182
    Comment on it

    Super Global variables are an assosciative array, that are predefined in PHP. Superglobal means they are always accessible and can be used in function, class or file.

    They are available in all scopes on script. We can use these variables directly without having to create them first. There are 8 superglobals available in php.

    Superglobals are:


    $_GET:    The $_GET  superglobal is  used to collect data after submission of form or data sent in the url.


    $_POST:    The $_POST superglobal is used to collect data after form submitting. S_POST is widely use to pass variables.


    $_COOKIE:    The $_COOKIE superglobal is used to store data available in a PHP script via HTTP cookies.


    $_REQUEST:    The $_REQUEST superglobal is used to collect data after submitting the form.


    $_SESSION:    The $_SESSION superglobal id is used for user information on server for later use.


    $_ENV:   $_ENV is superglobal variable used to manage environment variable.


    $_FILES:   $_FILES is used to accept binary/octet stream which we want to upload.


    $_SERVER:   The  $_SERVER is used to display or call information regarding the server. Ex- about the headers, paths, and script location etc. The $_Server accepts a list of elements that can be passed to get the information about server.



        Some of them are:


        $_SERVER['PHP_SELF'] :   It returns the filename of the currently executing script.
        $_SERVER['SERVER_NAME']:   It returns the name of the host server.
        $_SERVER['HTTP_HOST']:   It returns the Host header from the current request.
        $_SERVER['HTTP_REFERER']:   It returns the complete URL of the current page.
        $_SERVER['SCRIPT_NAME']:   It returns the path of the current script.


 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: