3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php touch('/tmp/x'); $x = new \SplFileInfo('/tmp/x'); echo (!$x) ? 1 : 0; var_dump($x); $s = boolval($x); echo (!$s) ? 1 : 0;
based on eGmdG
Output for 5.5.21 - 5.5.38, 5.6.5 - 7.2.0
0object(SplFileInfo)#1 (2) { ["pathName":"SplFileInfo":private]=> string(6) "/tmp/x" ["fileName":"SplFileInfo":private]=> string(1) "x" } 0
Output for 5.4.0 - 5.5.20, 5.6.0 - 5.6.4
Catchable fatal error: Object of class SplFileInfo could not be converted to boolean in /in/89j7P on line 5
Process exited with code 255.