Why am i seeing 'undefined variable' in php?

Example:

echo $undefinedVar;

This warning is displayed when you try to use a variable that hasn't been defined yet.

Solution:

Ensure the variable is defined before using it.


$undefinedVar = "Hello";
echo $undefinedVar;

Beginner's Guide to PHP