1.2.504. Global In Global

List of global variables. There are the global variables, defined with the global keyword, and the implicit global variables, defined in the global scope.

<?php
    global $explicitGlobal; // in global namespace

    $implicitGlobal = 1; // in global namespace, variables are automatically global

    function foo() {
        global $explicitGlobalInFoo; // in functions, globals must be declared with global
    }
?>

See also Variable Scope.

1.2.504.1. Specs

Short name

Structures/GlobalInGlobal

Rulesets

All, Appinfo, CE

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

global

Available in

Entreprise Edition, Community Edition, Exakat Cloud