Related Links : Search Engine Optimization | | Search Engine Marketing | Online Marketing | Freelance Programmer| SEO Thailand | SEO Expert | SEO services | PHP Programmer Thailand | SEO Tutorial | What is SEO |

  Home Our SEO Services SEO Expert Consultant Php Programmer Scripts| Email : sachin {at} jainsachin {dot} com

PHP | References all variables available in global scope | Manual | Tutorial | Help

SEO Services



Website Programming in PHP / MYSQL



Friends


    References all variables available in global scope

    $GLOBALS

    (No version information available, might be only in CVS)

    $GLOBALS — References all variables available in global scope

    Description

    An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array.

    Examples

    Example #1 $GLOBALS example

    <?php
    function test() {
        
    $foo "local variable";

        echo 
    '$foo in global scope: ' $GLOBALS["foo"] . "\n";
        echo 
    '$foo in current scope: ' $foo "\n";
    }

    $foo "Example content";
    test();
    ?>

    The above example will output something similar to:

    $foo in global scope: Example content
    $foo in current scope: local variable
    

    Notes

    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: Variable availability Unlike all of the other superglobals, $GLOBALS has essentially always been available in PHP.


    SEO Tutorial / Articles





    Php / Mysql Tutorial



    Articles



      Portfolio


      SEO by Jainsachin