If I reference a variable external to a function using "global", what happens if the variable doesn't exist?
Example:
// $discount does not exist
function doThing()
{
global $discount;
if (!empty($discount))
{
// do stuff
}
}
Nothing seems to break, but is it bad practice? Is there a better way to check if a variable exists outside a function?
- Bob