3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = <<<HTML This is some sample data which is going to contain an image in the format <img src="http://www.randomdomain.com/randomfolder/randomimagename.jpg">. It will also contain lots of other text and maybe another image or two like this: <img alt='another image' src='http://www.example.com/randomfolder/randomimagename.jpg'> HTML; $srcs = []; $dom=new DOMDocument; $dom->loadHTML($string); foreach ($dom->getElementsByTagName('img') as $img) { $srcs[] = $img->getAttribute('src'); } var_export($srcs);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'http://www.randomdomain.com/randomfolder/randomimagename.jpg', 1 => 'http://www.example.com/randomfolder/randomimagename.jpg', )

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:
124.94 ms | 405 KiB | 5 Q