Hi there,
I have a simple question to ask:
Say i have a PHP script:
<?php
var_dump($undeclaredVariable);
/* The output is NULL */
if($a==$b)
{
if($c == $d)
{
$undeclaredVariable = TRUE;
}
else
{
$undeclaredVariable = FALSE;
}
}
if($undeclaredVariable == TRUE)
{
echo 'the undeclared variable is TRUE';
}
if($undeclaredVariable == FALSE)
{
echo 'the undeclared variable is FALSE';
}
?>
Reading the PHP Type Comparison Table:
$x = null; boolean if($x) = FALSE
Using the code above, I see the "the undeclared variable is FALSE", which is OK since it proves the PHP documentation.
But as you can see, if $a !=$b then the $undeclaredVarable will not be declared(defined).
Is this an "OK" way to work this out? Or should I find a way to declare the variable whatever the case?
Thanks in advance,
Christos