3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><methodResponse><params><param><value><struct><member><name>Result</name><value><array><data><value><array><data><value><i4>1000045</i4></value><value><string>Fattura 24 Professional</string></value><value><i4>1000001</i4></value><value><i4>12</i4></value><value><string>Fattura 24 Professional</string></value><value><i4>30</i4></value><value><i4>50</i4></value><value><i4>1430683200</i4></value><value><i4>1433448000</i4></value><value><i4>1430769600</i4></value><value><i4>1433361600</i4></value><value><i4>2</i4></value><value><i4>1</i4></value></data></array></value></data></array></value></member></struct></value></param></params></methodResponse>"; $parser = xml_parser_create(); xml_parse_into_struct($parser , $xml_string, $array_result, $index); ob_start(); var_dump($array_result); $result = ob_get_clean(); echo $array_result[38]["value"]; echo $result;
based on 9Idl8
Output for 4.3.0 - 7.2.0
1433448000array(64) { [0]=> array(3) { ["tag"]=> string(14) "METHODRESPONSE" ["type"]=> string(4) "open" ["level"]=> int(1) } [1]=> array(3) { ["tag"]=> string(6) "PARAMS" ["type"]=> string(4) "open" ["level"]=> int(2) } [2]=> array(3) { ["tag"]=> string(5) "PARAM" ["type"]=> string(4) "open" ["level"]=> int(3) } [3]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(4) } [4]=> array(3) { ["tag"]=> string(6) "STRUCT" ["type"]=> string(4) "open" ["level"]=> int(5) } [5]=> array(3) { ["tag"]=> string(6) "MEMBER" ["type"]=> string(4) "open" ["level"]=> int(6) } [6]=> array(4) { ["tag"]=> string(4) "NAME" ["type"]=> string(8) "complete" ["level"]=> int(7) ["value"]=> string(6) "Result" } [7]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(7) } [8]=> array(3) { ["tag"]=> string(5) "ARRAY" ["type"]=> string(4) "open" ["level"]=> int(8) } [9]=> array(3) { ["tag"]=> string(4) "DATA" ["type"]=> string(4) "open" ["level"]=> int(9) } [10]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(10) } [11]=> array(3) { ["tag"]=> string(5) "ARRAY" ["type"]=> string(4) "open" ["level"]=> int(11) } [12]=> array(3) { ["tag"]=> string(4) "DATA" ["type"]=> string(4) "open" ["level"]=> int(12) } [13]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [14]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(7) "1000045" } [15]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [16]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [17]=> array(4) { ["tag"]=> string(6) "STRING" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(23) "Fattura 24 Professional" } [18]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [19]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [20]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(7) "1000001" } [21]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [22]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [23]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(2) "12" } [24]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [25]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [26]=> array(4) { ["tag"]=> string(6) "STRING" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(23) "Fattura 24 Professional" } [27]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [28]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [29]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(2) "30" } [30]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [31]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [32]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(2) "50" } [33]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [34]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [35]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(10) "1430683200" } [36]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [37]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [38]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(10) "1433448000" } [39]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [40]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [41]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(10) "1430769600" } [42]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [43]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [44]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(10) "1433361600" } [45]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [46]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [47]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(1) "2" } [48]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [49]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(4) "open" ["level"]=> int(13) } [50]=> array(4) { ["tag"]=> string(2) "I4" ["type"]=> string(8) "complete" ["level"]=> int(14) ["value"]=> string(1) "1" } [51]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(13) } [52]=> array(3) { ["tag"]=> string(4) "DATA" ["type"]=> string(5) "close" ["level"]=> int(12) } [53]=> array(3) { ["tag"]=> string(5) "ARRAY" ["type"]=> string(5) "close" ["level"]=> int(11) } [54]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(10) } [55]=> array(3) { ["tag"]=> string(4) "DATA" ["type"]=> string(5) "close" ["level"]=> int(9) } [56]=> array(3) { ["tag"]=> string(5) "ARRAY" ["type"]=> string(5) "close" ["level"]=> int(8) } [57]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(7) } [58]=> array(3) { ["tag"]=> string(6) "MEMBER" ["type"]=> string(5) "close" ["level"]=> int(6) } [59]=> array(3) { ["tag"]=> string(6) "STRUCT" ["type"]=> string(5) "close" ["level"]=> int(5) } [60]=> array(3) { ["tag"]=> string(5) "VALUE" ["type"]=> string(5) "close" ["level"]=> int(4) } [61]=> array(3) { ["tag"]=> string(5) "PARAM" ["type"]=> string(5) "close" ["level"]=> int(3) } [62]=> array(3) { ["tag"]=> string(6) "PARAMS" ["type"]=> string(5) "close" ["level"]=> int(2) } [63]=> array(3) { ["tag"]=> string(14) "METHODRESPONSE" ["type"]=> string(5) "close" ["level"]=> int(1) } }