3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = <<<HTML <img src="/image/fluffybunny.jpg" title="Harvey the bunny" alt="a cute little fluffy bunny" /> <img src='/image/pricklycactus.jpg' title='Roger the cactus' alt='a big green prickly cactus' /> <p>This is irrelevant text.</p> <img alt="an annoying white cockatoo" title="Polly the cockatoo" src="/image/noisycockatoo.jpg"> <img title=something src=somethingelse> HTML; libxml_use_internal_errors(true); // silences/forgives complaints from the parser (remove to see what is generated) $dom = new DOMDocument(); $dom->loadHTML($test); foreach ($dom->getElementsByTagName('img') as $i => $img) { echo "IMG#{$i}:\n"; echo "\tsrc = " , $img->getAttribute('src') , "\n"; echo "\ttitle = " , $img->getAttribute('title') , "\n"; echo "\talt = " , $img->getAttribute('alt') , "\n"; echo "---\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
IMG#0: src = /image/fluffybunny.jpg title = Harvey the bunny alt = a cute little fluffy bunny --- IMG#1: src = /image/pricklycactus.jpg title = Roger the cactus alt = a big green prickly cactus --- IMG#2: src = /image/noisycockatoo.jpg title = Polly the cockatoo alt = an annoying white cockatoo --- IMG#3: src = somethingelse title = something alt = ---

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