3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $x = new SimpleXMLElement('<properties> <property> <label><![CDATA[Art.Nr.]]></label> <value><![CDATA[0079581233]]></value> </property> <property> <label><![CDATA[Volumen]]></label> <value><![CDATA[16 Liter]]></value> </property> <property> <label><![CDATA[Material]]></label> <value><![CDATA[Polyamide]]></value> </property> <property> <label><![CDATA[Handgepäck]]></label> <value><![CDATA[ja]]></value> </property> <property> <label><![CDATA[Serie]]></label> <value><![CDATA[Basic Backpacks]]></value> </property> <property> <label><![CDATA[Gepäckart]]></label> <value><![CDATA[Weichgepäck]]></value> </property> <property> <label><![CDATA[Farbe]]></label> <value><![CDATA[Black]]></value> </property> <property> <label><![CDATA[Ma&szlig;e]]></label> <value><![CDATA[21 * 26 * 36 m]]></value> </property> </properties>'); var_dump($x->property->value); var_dump((string) $x->property->value); $v = new StdClass(); try { var_dump(strval($v)); } catch (Exception $e) { var_dump( $v); }
based on 0iZdQ
Output for 7.1.0 - 7.3.0alpha1
object(SimpleXMLElement)#4 (1) { [0]=> object(SimpleXMLElement)#3 (0) { } } string(10) "0079581233" Recoverable fatal error: Object of class stdClass could not be converted to string in /in/ukNiu on line 44
Process exited with code 255.
Output for 5.5.0 - 7.0.20
object(SimpleXMLElement)#4 (1) { [0]=> object(SimpleXMLElement)#3 (0) { } } string(10) "0079581233" Catchable fatal error: Object of class stdClass could not be converted to string in /in/ukNiu on line 44
Process exited with code 255.