3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xml_encode($mixed, $domElement=null, $DOMDocument=null) { if (is_null($DOMDocument)) { $DOMDocument =new DOMDocument; $DOMDocument->formatOutput = true; xml_encode($mixed, $DOMDocument, $DOMDocument); echo $DOMDocument->saveXML(); } else { if (is_array($mixed)) { foreach ($mixed as $index => $mixedElement) { if (is_int($index)) { if ($index === 0) { $node = $domElement; } else { $node = $DOMDocument->createElement($domElement->tagName); $domElement->parentNode->appendChild($node); } } else { $plural = $DOMDocument->createElement($index); $domElement->appendChild($plural); $node = $plural; if (!(rtrim($index, 's') === $index)) { $singular = $DOMDocument->createElement(rtrim($index, 's')); $plural->appendChild($singular); $node = $singular; } } xml_encode($mixedElement, $node, $DOMDocument); } } else { $mixed = is_bool($mixed) ? ($mixed ? 'true' : 'false') : $mixed; $domElement->appendChild($DOMDocument->createTextNode($mixed)); } } } $str = xml_encode( array ( 'cry_shop' => array ( 'packs' => array ( 3 => array ( 'id' => 3, 'minLevel' => 1, 'elements' => array ( 'crystal' => array ( 'count' => 100, 'offer' => NULL, 'probability' => NULL, 'offerVal' => NULL, 'offerStartTime' => NULL, 'offerEndTime' => NULL, ), ), 'inapSystemName' => 'inap1', 'priceCraft' => array ( ), 'priceCrystal' => NULL, 'crystalOffer' => NULL, 'crystalOfferVal' => NULL, 'crystalOfferStartTime' => NULL, 'crystalOfferEndTime' => NULL, 'translationTitle' => NULL, 'translationDescription' => NULL, ), ), 'translationTitle' => NULL, 'translationDescription' => NULL, ), 'gold_shop' => array ( 'packs' => array ( 2 => array ( 'id' => 2, 'minLevel' => 1, 'elements' => array ( 'gold' => array ( 'count' => 500, 'offer' => NULL, 'probability' => NULL, 'offerVal' => NULL, 'offerStartTime' => NULL, 'offerEndTime' => NULL, ), ), 'inapSystemName' => 'inap1', 'priceCraft' => array ( ), 'priceCrystal' => NULL, 'crystalOffer' => NULL, 'crystalOfferVal' => NULL, 'crystalOfferStartTime' => NULL, 'crystalOfferEndTime' => NULL, 'translationTitle' => NULL, 'translationDescription' => NULL, ), ), 'translationTitle' => NULL, 'translationDescription' => NULL, ), 'res_shop' => array ( 'packs' => array ( 1 => array ( 'id' => 1, 'minLevel' => 1, 'elements' => array ( 'wood' => array ( 'count' => 30, 'offer' => NULL, 'probability' => NULL, 'offerVal' => NULL, 'offerStartTime' => NULL, 'offerEndTime' => NULL, ), 'stone' => array ( 'count' => 50, 'offer' => NULL, 'probability' => NULL, 'offerVal' => NULL, 'offerStartTime' => NULL, 'offerEndTime' => NULL, ), ), 'inapSystemName' => NULL, 'priceCraft' => array ( ), 'priceCrystal' => NULL, 'crystalOffer' => NULL, 'crystalOfferVal' => NULL, 'crystalOfferStartTime' => NULL, 'crystalOfferEndTime' => NULL, 'translationTitle' => NULL, 'translationDescription' => NULL, ), ), 'translationTitle' => NULL, 'translationDescription' => NULL, ), 'util_shop' => array ( 'packs' => array ( 4 => array ( 'id' => 4, 'minLevel' => 0, 'elements' => array ( 'dropRequestCounter' => array ( 'count' => 1, 'offer' => NULL, 'probability' => NULL, 'offerVal' => NULL, 'offerStartTime' => NULL, 'offerEndTime' => NULL, ), ), 'inapSystemName' => NULL, 'priceCraft' => array ( ), 'priceCrystal' => 5, 'crystalOffer' => NULL, 'crystalOfferVal' => NULL, 'crystalOfferStartTime' => NULL, 'crystalOfferEndTime' => NULL, 'translationTitle' => NULL, 'translationDescription' => NULL, ), ), 'translationTitle' => NULL, 'translationDescription' => NULL, ), ) ); var_dump($str);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in /in/7SBOP on line 37 <?xml version="1.0"?> <cry_shop> <packs> <pack/> <pack> <id>3</id> <minLevel>1</minLevel> <elements> <element> <crystal> <count>100</count> <offer></offer> <probability></probability> <offerVal></offerVal> <offerStartTime></offerStartTime> <offerEndTime></offerEndTime> </crystal> </element> </elements> <inapSystemName>inap1</inapSystemName> <priceCraft/> <priceCrystal></priceCrystal> <crystalOffer></crystalOffer> <crystalOfferVal></crystalOfferVal> <crystalOfferStartTime></crystalOfferStartTime> <crystalOfferEndTime></crystalOfferEndTime> <translationTitle></translationTitle> <translationDescription></translationDescription> </pack> </packs> <translationTitle></translationTitle> <translationDescription></translationDescription> </cry_shop> <gold_shop> <packs> <pack/> <pack> <id>2</id> <minLevel>1</minLevel> <elements> <element> <gold> <count>500</count> <offer></offer> <probability></probability> <offerVal></offerVal> <offerStartTime></offerStartTime> <offerEndTime></offerEndTime> </gold> </element> </elements> <inapSystemName>inap1</inapSystemName> <priceCraft/> <priceCrystal></priceCrystal> <crystalOffer></crystalOffer> <crystalOfferVal></crystalOfferVal> <crystalOfferStartTime></crystalOfferStartTime> <crystalOfferEndTime></crystalOfferEndTime> <translationTitle></translationTitle> <translationDescription></translationDescription> </pack> </packs> <translationTitle></translationTitle> <translationDescription></translationDescription> </gold_shop> <res_shop> <packs> <pack/> <pack> <id>1</id> <minLevel>1</minLevel> <elements> <element> <wood> <count>30</count> <offer></offer> <probability></probability> <offerVal></offerVal> <offerStartTime></offerStartTime> <offerEndTime></offerEndTime> </wood> <stone> <count>50</count> <offer></offer> <probability></probability> <offerVal></offerVal> <offerStartTime></offerStartTime> <offerEndTime></offerEndTime> </stone> </element> </elements> <inapSystemName></inapSystemName> <priceCraft/> <priceCrystal></priceCrystal> <crystalOffer></crystalOffer> <crystalOfferVal></crystalOfferVal> <crystalOfferStartTime></crystalOfferStartTime> <crystalOfferEndTime></crystalOfferEndTime> <translationTitle></translationTitle> <translationDescription></translationDescription> </pack> </packs> <translationTitle></translationTitle> <translationDescription></translationDescription> </res_shop> <util_shop> <packs> <pack/> <pack> <id>4</id> <minLevel>0</minLevel> <elements> <element> <dropRequestCounter> <count>1</count> <offer></offer> <probability></probability> <offerVal></offerVal> <offerStartTime></offerStartTime> <offerEndTime></offerEndTime> </dropRequestCounter> </element> </elements> <inapSystemName></inapSystemName> <priceCraft/> <priceCrystal>5</priceCrystal> <crystalOffer></crystalOffer> <crystalOfferVal></crystalOfferVal> <crystalOfferStartTime></crystalOfferStartTime> <crystalOfferEndTime></crystalOfferEndTime> <translationTitle></translationTitle> <translationDescription></translationDescription> </pack> </packs> <translationTitle></translationTitle> <translationDescription></translationDescription> </util_shop> NULL

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
56.53 ms | 429 KiB | 8 Q