3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parse_attributes($input) { $dom = new DomDocument(); $dom->loadHtml("<foo " . $input. "/>"); $attributes = array(); foreach ($dom->documentElement->attributes as $name => $attr) { $attributes[$name] = $node->value; } return $attributes; } $content = '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/156742959&amp;color=ff5500&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false"></iframe>'; $params = parse_attributes($content); var_dump($params);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: DOMDocument::loadHTML(): error parsing attribute name in Entity, line: 1 in /in/jcRps on line 4 Warning: DOMDocument::loadHTML(): Tag foo invalid in Entity, line: 1 in /in/jcRps on line 4 Warning: DOMDocument::loadHTML(): Unexpected end tag : iframe in Entity, line: 1 in /in/jcRps on line 4 array(0) { }

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