3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $left = 4; $right = '4'; function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);} it("should compare simple values as equals", $left == $right); it("should NOT compare ints and strings as equals if using identity", $left === $right); it("should compare by identity if you typecast a string to an int", $left === (int) $right); it("should compare by identity if you typecast an int to a string", (string) $left === $right);
Output for 4.3.0 - 7.1.0
✔︎ It should compare simple values as equals ✘ It should NOT compare ints and strings as equals if using identity ✔︎ It should compare by identity if you typecast a string to an int ✔︎ It should compare by identity if you typecast an int to a string