3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "Did you know strings are numbers?\n"; $number = "2sdfsdfjoi"; var_dump($number == 2); // = true (wat?) $number = "22sdfsdfjoi"; var_dump($number == 2); // = false (makes sense...) var_dump($number == 22); // = true (wait, wat?) echo "Strings are also both true and false\n"; var_dump($number == true); // string = true (ugghh) var_dump($number == false); // string also = false (kill me now) echo "The triple equals === is the only way to be sure\n"; var_dump($number === 22); // === the only way to be sure.
based on ph3r6
Output for 4.3.0 - 5.0.5, 5.1.1 - 7.2.0
Did you know strings are numbers? bool(true) bool(false) bool(true) Strings are also both true and false bool(true) bool(false) The triple equals === is the only way to be sure bool(false)
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/2T7Sd on line 16
Process exited with code 255.