Here is another 'oops!' moment for PHP. Do you remember the rule of transitivity? A related to B, and A related to C, implies that B is related to C. Right? Now apply this very understanding to the code below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo ("foo" == 0)?"foo equals 0\n":"foo does not equal 0\n"; // prints "foo equals 0" | |
echo ("foo" == true)?"foo equals true\n":"foo does not equal true\n"; // prints "foo equals true" | |
echo (true == 0)?"true equals 0\n":"true does not equal 0\n"; // prints "true does not equal 0" | |
?> |
No comments:
Post a Comment