3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SimpleXMLExtended extends SimpleXMLElement { public function addCData($cdata_text) { $node = dom_import_simplexml($this); $no = $node->ownerDocument; $node->appendChild($no->createCDATASection($cdata_text)); } } $oXML = new SimpleXMLExtended('<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0" />'); $oChannel = $oXML->addChild('channel'); $oChannel->addChild('title', 'TEST'); $oProduct = $oChannel->addChild('item'); $oProduct->addChild('condition1', 'new', 'http://base.google.com/ns/1.0'); $oProduct->addChild('condition2', 'new', 'http://base.google.com/ns/1.0'); $oProduct->product_type = null; $oProduct->product_type->addCData('TEST - HOW TO GET NAMESPACE HERE'); $oProduct->addChild('condition3', 'new', 'http://base.google.com/ns/1.0'); echo $oXML->asXML();
Output for git.master, git.master_jit, rfc.property-hooks
<?xml version="1.0"?> <rss xmlns:g="http://base.google.com/ns/1.0" version="2.0"><channel><title>TEST</title><item><g:condition1>new</g:condition1><g:condition2>new</g:condition2><product_type><![CDATA[TEST - HOW TO GET NAMESPACE HERE]]></product_type><g:condition3>new</g:condition3></item></channel></rss>

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:
120.44 ms | 406 KiB | 5 Q