[nycphp-talk] ${$variable}
Chris Snyder
csnyder at chxo.com
Wed Aug 27 18:40:29 EDT 2003
Analysis & Solutions wrote:
>I just learned something interesting while confirming stuff:
>
> $bar = 0;
> if ($bar == '') {
> echo '<br />bar equals empty';
> }
>
>This comparison will evaluate to true, so the message will be printed.
>
>
>
Which was really the whole point of this exercise -- but you dropped
another hint there with the strict comparison operator (===).
In "standard" style this time:
if ( isset($foo) ) {
if ( $foo==='' ) {
print "foo is an empty string.";
}
}
And that's all we really needed: a fine lesson in strict vs loose
comparison.
http://www.php.net/manual/en/types.comparisons.php
More information about the talk
mailing list