3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 = '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"'; $params = parse_attributes($content); var_dump($params);
based on jcRps
Output for 5.0.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: DOMDocument::loadHTML(): Tag foo invalid in Entity, line: 1 in /in/chTdK on line 4 array(0) { }
Output for hhvm-3.10.0 - 3.12.0
Warning: Tag foo invalid in Entity, line: 1 array(0) { }
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/chTdK on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/chTdK on line 3