Undefined variable

Description

This notice is emitted when a variable is being used before being defined. In a word, the variable is not created yet, so PHP creates it on the fly, as NULL, then uses it.

Example

<?php

echo $x;

?>

Solutions

  • Give the variable a default value.