3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml =<<<EOL <TimelineObject> <id><![CDATA[12577372733072486582]]></id> <username><![CDATA[wxid_lj7cpmhigv9h12]]></username> <createTime><![CDATA[1499339667]]></createTime> <contentDescShowType>0</contentDescShowType> <contentDescScene>3</contentDescScene> <private><![CDATA[0]]></private> <contentDesc><![CDATA[?个小时, 总感觉腿不是自己的了。[坏笑]\u0003]]></contentDesc> <contentattr><![CDATA[0]]></contentattr> <sourceUserName></sourceUserName> <sourceNickName></sourceNickName> <statisticsData></statisticsData> </TimelineObject> EOL; var_dump(simplexml_load_string($xml)); var_dump(simplexml_load_string($xml, null, LIBXML_NOCDATA));
based on JGZZr
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.2.8
object(SimpleXMLElement)#1 (11) { ["id"]=> object(SimpleXMLElement)#2 (0) { } ["username"]=> object(SimpleXMLElement)#3 (0) { } ["createTime"]=> object(SimpleXMLElement)#4 (0) { } ["contentDescShowType"]=> string(1) "0" ["contentDescScene"]=> string(1) "3" ["private"]=> object(SimpleXMLElement)#5 (0) { } ["contentDesc"]=> object(SimpleXMLElement)#6 (0) { } ["contentattr"]=> object(SimpleXMLElement)#7 (0) { } ["sourceUserName"]=> object(SimpleXMLElement)#8 (0) { } ["sourceNickName"]=> object(SimpleXMLElement)#9 (0) { } ["statisticsData"]=> object(SimpleXMLElement)#10 (0) { } } object(SimpleXMLElement)#1 (11) { ["id"]=> string(20) "12577372733072486582" ["username"]=> string(19) "wxid_lj7cpmhigv9h12" ["createTime"]=> string(10) "1499339667" ["contentDescShowType"]=> string(1) "0" ["contentDescScene"]=> string(1) "3" ["private"]=> string(1) "0" ["contentDesc"]=> string(64) "?个小时, 总感觉腿不是自己的了。[坏笑]\u0003" ["contentattr"]=> string(1) "0" ["sourceUserName"]=> object(SimpleXMLElement)#10 (0) { } ["sourceNickName"]=> object(SimpleXMLElement)#9 (0) { } ["statisticsData"]=> object(SimpleXMLElement)#8 (0) { } }
Output for hhvm-3.15.4
object(SimpleXMLElement)#1 (11) { ["id"]=> object(SimpleXMLElement)#2 (0) { } ["username"]=> object(SimpleXMLElement)#3 (0) { } ["createTime"]=> object(SimpleXMLElement)#4 (0) { } ["contentDescShowType"]=> string(1) "0" ["contentDescScene"]=> string(1) "3" ["private"]=> object(SimpleXMLElement)#5 (0) { } ["contentDesc"]=> object(SimpleXMLElement)#6 (0) { } ["contentattr"]=> object(SimpleXMLElement)#7 (0) { } ["sourceUserName"]=> object(SimpleXMLElement)#8 (0) { } ["sourceNickName"]=> object(SimpleXMLElement)#9 (0) { } ["statisticsData"]=> object(SimpleXMLElement)#10 (0) { } } Warning: simplexml_load_string() expects parameter 2 to be string, null given in /in/hZo7r on line 22 NULL