3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = array("", NULL, 0, 1, "0", "1", true, false, new stdClass(), array(1), array()); echo "X\t!!(x)\t(x==true)\t(x===true)=\n\n"; foreach($test as $t) { echo var_export($t, true) . "\t" . var_export((!!$t), true) . "\t" . var_export(($t==true),true). "\t" . var_export(($t===true),true). "\n"; }
based on Eq4jB
Output for 5.1.0 - 7.2.0
X !!(x) (x==true) (x===true)= '' false false false NULL false false false 0 false false false 1 true true false '0' false false false '1' true true false true true true true false false false false stdClass::__set_state(array( )) true true false array ( 0 => 1, ) true true false array ( ) false false false
Output for 5.0.0 - 5.0.5
X !!(x) (x==true) (x===true)= '' false false false NULL false false false 0 false false false 1 true true false '0' false false false '1' true true false true true true true false false false false class stdClass { } true true false array ( 0 => 1, ) true true false array ( ) false false false
Output for 4.3.0 - 4.4.9
X !!(x) (x==true) (x===true)= '' false false false NULL false false false 0 false false false 1 true true false '0' false false false '1' true true false true true true true false false false false class stdClass { } false false false array ( 0 => 1, ) true true false array ( ) false false false