1.2.1289. Unused Global

A global keyword is used in a method, yet the variable is not actually used. This makes PHP import values for nothing, or may create interference

<?php
    function foo() {
        global bar;

        return 1;
    }
?>

1.2.1289.1. Suggestions

  • Remove the global declaration

  • Remove the global variable altogether

1.2.1289.2. Specs

Short name

Structures/UnusedGlobal

Rulesets

All, Analyze

Exakat since

0.8.4

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Features

global, unused

Examples

Dolphin

Available in

Entreprise Edition, Exakat Cloud