3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = ' Here is some text and also: <figure class="class-one"> <img src="/example.jpg" alt="example alt" class="some-image-class"> <figcaption>example caption</figcaption> </figure> And another one (and many more): <figure class="class-one some-other-class"> <img src="/example2.jpg" alt="example2 alt"> </figure>'; $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($html); libxml_clear_errors(); $images = $dom->getElementsByTagName('img'); $figures = $dom->getElementsByTagName('figure'); $figures = array(); foreach ($figures as $figure) { $figures['class'] = $figure->getAttribute('class'); } print_r($figures);
Output for git.master_jit, git.master, rfc.property-hooks
Array ( )

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:
37.86 ms | 401 KiB | 8 Q