Wrong I'm affraid.
an Undefined variable is exactly that: undefined.
It has no value, it's illegal to use, bad naughty bad go stand in a corner and be ashamed bad.
A) this should never happen because your program should check EVERY variable when it's first used to see if it's defined:
if (!isset($variable))
{
// variable not defined, give it a default value.
};
😎 PHP can't deal with something undefined, which means that allmost every function you put an 'undefined' into will fail and return 'FALSE'.
This means that things like this will work if $g is not defined:
if (!$g)
{
// $g was not supplied
};
But this is EXTEREMELY BAD PRACTICE.
And why? because this just checks if $g!=0.
PHP can't handle 'undefined', so it treats $g as if it where FALSE, and then it works.
But in PHP FALSE=0, so if $g=0 this function would also work. et presto: doodie hit's the fan.
Tip: allways start your scripts with:
error_reporting(E_ALL);
that will tell you everything you are doing wrong.
A good script is one that has zero errors and zero warnings.