3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div> <p> <iframe allowfullscreen="" class="media-element file-default" data-fid="2219" data-media-element="1" frameborder="0" height="360" src="https://www.youtube.com/embed/sNEJOm4hSaw" width="640"></iframe> </p> <p> <iframe allowfullscreen="" class="media-element file-default" data-fid="2219" data-media-element="1" frameborder="0" height="360" src="https://www.youtube.com/embed/abcdefghijk" width="640"></iframe> </p> </div> HTML; $dom = new DOMDocument; $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); while ($iframe = $dom->getElementsByTagName('iframe')->item(0)) { $amp = $dom->createElement('amp-youtube'); $amp->setAttribute('width', '480'); $amp->setAttribute('height', '270'); $amp->setAttribute('layout', 'responsive'); $amp->setAttribute('data-videoid', str_replace("https://www.youtube.com/embed/","", $iframe->getAttribute('src'))); $iframe->parentNode->replaceChild($amp, $iframe); } echo $dom->saveHTML();
Output for git.master, git.master_jit, rfc.property-hooks
<div> <p> <amp-youtube width="480" height="270" layout="responsive" data-videoid="sNEJOm4hSaw"></amp-youtube> </p> <p> <amp-youtube width="480" height="270" layout="responsive" data-videoid="abcdefghijk"></amp-youtube> </p> </div>

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:
19.64 ms | 402 KiB | 8 Q