No Warning For Unused Variables

../_images/variable_optimisation.png

PHP variable optimisation in action: the undefined variables are only reported when they are used.

The first is omitted : there are no operations.

The second is skipped : no need to execute the second term of the or.

The third is reporting a warning.

Of course, an assignation is not reported with an undefined variable, as it will be set. Although, may be reusage of a variable could be reported.

See Also

PHP Features