3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function parse_attributes($input) { $dom = new DomDocument(); $dom->loadHtml($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);
based on chTdK
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(0) { }
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/cXDsc 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/cXDsc on line 3