3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '<?xml version="1.0" ?> <data> <action>insert_message</action> <reactid>00000000000000000000000000000000</reactid> <topicid>126628</topicid> <content> [quote][b][message=10028109,noline]aintnosweet schreef op dinsdag 20 september 2011 14:23[/message][/b] .<b>Meedoen? .Check <a href="http://www.frontrunner.nl/converse" class="link">http://www.frontrunner.nl/converse</a></b> [/quote].test </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) { // if(isset($element['value'])) $data[ $element['tag'] ] = $element['value']; } } var_dump($data);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Warning: Undefined array key "value" in /in/tf9E9 on line 31 array(4) { ["action"]=> string(14) "insert_message" ["topicid"]=> string(6) "126628" ["fields"]=> NULL ["mobile"]=> string(6) "iphone" }
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined index: value in /in/tf9E9 on line 31 array(4) { ["action"]=> string(14) "insert_message" ["topicid"]=> string(6) "126628" ["fields"]=> NULL ["mobile"]=> string(6) "iphone" }
Output for 7.3.32 - 7.3.33
array(4) { ["action"]=> string(14) "insert_message" ["topicid"]=> string(6) "126628" ["fields"]=> NULL ["mobile"]=> string(6) "iphone" }
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Notice: Undefined index: value in /in/tf9E9 on line 31 array(4) { ["action"]=> string(14) "insert_message" ["topicid"]=> string(6) "126628" ["fields"]=> NULL ["mobile"]=> string(6) "iphone" }
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
Notice: Undefined index: value in /in/tf9E9 on line 31 Notice: Undefined index: value in /in/tf9E9 on line 31 Notice: Undefined index: value in /in/tf9E9 on line 31 array(8) { ["action"]=> string(14) "insert_message" ["reactid"]=> string(32) "00000000000000000000000000000000" ["topicid"]=> string(6) "126628" ["content"]=> NULL ["b"]=> NULL ["a"]=> string(34) "http://www.frontrunner.nl/converse" ["fields"]=> NULL ["mobile"]=> string(6) "iphone" }

preferences:
230.16 ms | 403 KiB | 384 Q