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()); foreach($test as $t) { echo var_export($t, true) . "\t !!(x)=\t" . var_export((!!$t), true) . "\t (x==true)=\t" . var_export(($t==true),true). "\t (x===true)=\t" . var_export(($t===true),true). "\n"; }
based on Hvg0Z
Output for 5.1.0 - 7.2.0
'' !!(x)= false (x==true)= false (x===true)= false NULL !!(x)= false (x==true)= false (x===true)= false 0 !!(x)= false (x==true)= false (x===true)= false 1 !!(x)= true (x==true)= true (x===true)= false '0' !!(x)= false (x==true)= false (x===true)= false '1' !!(x)= true (x==true)= true (x===true)= false true !!(x)= true (x==true)= true (x===true)= true false !!(x)= false (x==true)= false (x===true)= false stdClass::__set_state(array( )) !!(x)= true (x==true)= true (x===true)= false array ( 0 => 1, ) !!(x)= true (x==true)= true (x===true)= false array ( ) !!(x)= false (x==true)= false (x===true)= false
Output for 5.0.0 - 5.0.5
'' !!(x)= false (x==true)= false (x===true)= false NULL !!(x)= false (x==true)= false (x===true)= false 0 !!(x)= false (x==true)= false (x===true)= false 1 !!(x)= true (x==true)= true (x===true)= false '0' !!(x)= false (x==true)= false (x===true)= false '1' !!(x)= true (x==true)= true (x===true)= false true !!(x)= true (x==true)= true (x===true)= true false !!(x)= false (x==true)= false (x===true)= false class stdClass { } !!(x)= true (x==true)= true (x===true)= false array ( 0 => 1, ) !!(x)= true (x==true)= true (x===true)= false array ( ) !!(x)= false (x==true)= false (x===true)= false
Output for 4.3.0 - 4.4.9
'' !!(x)= false (x==true)= false (x===true)= false NULL !!(x)= false (x==true)= false (x===true)= false 0 !!(x)= false (x==true)= false (x===true)= false 1 !!(x)= true (x==true)= true (x===true)= false '0' !!(x)= false (x==true)= false (x===true)= false '1' !!(x)= true (x==true)= true (x===true)= false true !!(x)= true (x==true)= true (x===true)= true false !!(x)= false (x==true)= false (x===true)= false class stdClass { } !!(x)= false (x==true)= false (x===true)= false array ( 0 => 1, ) !!(x)= true (x==true)= true (x===true)= false array ( ) !!(x)= false (x==true)= false (x===true)= false