3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(E_ALL ^ E_NOTICE); $input = '<?xml version="1.0" ?><data><action>insert_message</action><reactid>00000000000000000000000000000000</reactid><topicid>126628</topicid><content><![CDATA[Test <a href="Wa">Meukee</a> Hoedel!]]></content><fields><mobile>iphone</mobile></fields></data>'; $xml_parser = xml_parser_create(''); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0); xml_parse_into_struct($xml_parser, $input, $vals); $inData = false; foreach($vals as $element) { if(strtolower($element['tag']) == 'data') { $inData = !$inData; } elseif($inData) { $data[ $element['tag'] ] = $element['value']; } } var_dump($data);
Output for 4.3.0 - 7.1.0
array(6) { ["action"]=> string(14) "insert_message" ["reactid"]=> string(32) "00000000000000000000000000000000" ["topicid"]=> string(6) "126628" ["content"]=> string(39) "Test <a href="Wa">Meukee</a> Hoedel!" ["fields"]=> NULL ["mobile"]=> string(6) "iphone" }