3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = new SimpleXMLElement('<tag></tag>'); echo 'An empty SimpleXMLElement is '; var_export((bool) $xml); echo "\n"; $xml = new SimpleXMLElement('<tag>data</tag>'); echo 'A SimpleXMLElement with data is '; var_export((bool) $xml); echo "\n"; $obj = new stdClass(); echo 'An empty stdClass is '; var_export((bool) $obj); echo "\n"; class A { public function __toString() { return ''; } } $a = new A(); echo 'A class that returns an empty string from __toString() is '; var_export((string) $a);

preferences:
54.39 ms | 402 KiB | 5 Q