|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-05-14 21:51 UTC] ethan dot nelson at ltd dot org
Description: ------------ Right now, 0 compared to any string will prove true. Reproduce code: --------------- <?php if (0 == 'anystring') echo "True"; else echo "False"; ?> Expected result: ---------------- False Actual result: -------------- True PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 22:00:01 2025 UTC |
It seems object do behave the way one would expect strings to (furthering the inconsistency imo), as demonstrated by this example: class Tester { } $tester = new Tester(); var_dump(0 == $tester); // false echo "<br />"; var_dump(0 == false); // true echo "<br />"; var_dump(false == $tester); // false echo "<br />";