متغیرهای از پیش تعریف شده
PHP Manual

$GLOBALS

$GLOBALSتمام متغیرهای موجود در حوزه جهانی را پوشش می‌دهد

Description

یک 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: وجود متغیرها

برخلاف دیگر superglobals $GLOBALS همیشه در PHP حاضر بوده است.


متغیرهای از پیش تعریف شده
PHP Manual