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