3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function xml2assoc($obj, &$arr) { $children = $obj->children(); foreach ( $children as $elementName => $node ) { if (!isset($arr[$elementName])) { $arr[$elementName] = array(); } $temp = array(); $attributes = $node->attributes(); foreach ( $attributes as $attributeName => $attributeValue ) { $attribName = strtolower(trim((string) $attributeName)); $attribVal = trim((string) $attributeValue); $temp[$attribName] = $attribVal; } $text = (string) $node; $text = trim($text); if (strlen($text) > 0) { $temp ['text='] = $text; } $arr[$elementName][] = $temp; $nextIdx = count($arr[$elementName]); xml2assoc($node, $arr[$elementName][$nextIdx - 1]); } return; } $xml = "<TABLA-INSCRIPCION><T-REG-MERC-FIRMA><Z-NIFCIF-IS>P1.1</Z-NIFCIF-IS><Z-ISCRIZIONE-IS>P2.1</Z-ISCRIZIONE-IS><Z-FIRMATARIO-IS>P3.1</Z-FIRMATARIO-IS><Z-COD-FISC-FIRMAT-IS>P4.1</Z-COD-FISC-FIRMAT-IS><Z-STRINGA-IS>P5.1</Z-STRINGA-IS><Z-NUM-PROTOCOLLO-IS>P6.1</Z-NUM-PROTOCOLLO-IS><Z-DATA-PROTOCOLLO-IS>P7.1</Z-DATA-PROTOCOLLO-IS><Z-NOTAIO-FIRMAT-IS>P8.1</Z-NOTAIO-FIRMAT-IS><Z-FIRMATARIO-I2>P9.1</Z-FIRMATARIO-I2><Z-COD-FISC-FIRMAT-I2>P10.1</Z-COD-FISC-FIRMAT-I2><Z-STRINGA-I2>P11.1</Z-STRINGA-I2><Z-NUM-PROTOCOLLO-I2>P12.1</Z-NUM-PROTOCOLLO-I2><Z-DATA-PROTOCOLLO-I2>P13.1</Z-DATA-PROTOCOLLO-I2><Z-NOTAIO-FIRMAT-I2>P14.1</Z-NOTAIO-FIRMAT-I2></T-REG-MERC-FIRMA><T-REG-MERC-FIRMA><Z-NIFCIF-IS>P1.2</Z-NIFCIF-IS><Z-ISCRIZIONE-IS>P2.2</Z-ISCRIZIONE-IS><Z-FIRMATARIO-IS>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z-COD-FISC-FIRMAT-I2><Z-STRINGA-I2>P11.5</Z-STRINGA-I2><Z-NUM-PROTOCOLLO-I2>P12.5</Z-NUM-PROTOCOLLO-I2><Z-DATA-PROTOCOLLO-I2>P13.5</Z-DATA-PROTOCOLLO-I2><Z-NOTAIO-FIRMAT-I2>P14.5</Z-NOTAIO-FIRMAT-I2></T-REG-MERC-FIRMA><T-REG-MERC-FIRMA><Z-NIFCIF-IS>P1.6</Z-NIFCIF-IS><Z-ISCRIZIONE-IS>P2.6</Z-ISCRIZIONE-IS><Z-FIRMATARIO-IS>P3.6</Z-FIRMATARIO-IS><Z-COD-FISC-FIRMAT-IS>P4.6</Z-COD-FISC-FIRMAT-IS><Z-STRINGA-IS>P5.6</Z-STRINGA-IS><Z-NUM-PROTOCOLLO-IS>P6.6</Z-NUM-PROTOCOLLO-IS><Z-DATA-PROTOCOLLO-IS>P7.6</Z-DATA-PROTOCOLLO-IS><Z-NOTAIO-FIRMAT-IS>P8.6</Z-NOTAIO-FIRMAT-IS><Z-FIRMATARIO-I2>P9.6</Z-FIRMATARIO-I2><Z-COD-FISC-FIRMAT-I2>P10.6</Z-COD-FISC-FIRMAT-I2><Z-STRINGA-I2>P11.6</Z-STRINGA-I2><Z-NUM-PROTOCOLLO-I2>P12.6</Z-NUM-PROTOCOLLO-I2><Z-DATA-PROTOCOLLO-I2>P13.6</Z-DATA-PROTOCOLLO-I2><Z-NOTAIO-FIRMAT-I2>P14.6</Z-NOTAIO-FIRMAT-I2></T-REG-MERC-FIRMA></TABLA-INSCRIPCION>"; $x = simplexml_load_string ($xml) ?>
based on QLGl4
Output for 5.0.0 - 7.3.0rc4
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/gZ4rf on line 30
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_string() in /in/gZ4rf on line 30
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/gZ4rf on line 30