Description

Category: Coding Style

A local variable is used before it is defined. Even though PHP initializes variables with empty values on the first use, it is considered a good practice to explicitly initialize variables to make code more readable and avoid unnecessary bugs.

Example

function foo()
{
    
// $a was never initialized!
    
if ($a > 0) {
        ...
    }
}