3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = ' <html><head></head><body> <div class="single-post-image" style="background-image:url(https://www.mmowg.net/wp-content/uploads/2020/11/a8Tnv1kVyXY.jpg)"></div> <div class="single-post-image" style="background-image: url(https://www.mmowg.net/wp-content/uploads/2020/11/a8Tnv1kVyXY.jpg )"></div> <div class="single-post-image" style="background-image: url( https://www.mmowg.net/wp-content/uploads/2020/11/a8Tnv1kVyXY.jpg)"></div> <div class="single-post-image" style="background-image: url(\'https://www.mmowg.net/wp-content/uploads/2020/11/a8Tnv1kVyXY.jpg\')"></div> <div class="single-post-image"></div> </body> </html>'; $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($html); libxml_clear_errors(); $xpath = new DomXPath($dom); $images = []; foreach ($xpath->query("//*[contains(@class, 'single-post-image')]") as $img) { if ($img->hasAttribute('style')) { preg_match('/url\((.*)\)/', $img->getAttribute('style'), $match); if (isset($match[1])) $images[] = trim($match[1], '\'" '); } } print_r($images);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => https://www.mmowg.net/wp-content/uploads/2020/11/a8Tnv1kVyXY.jpg [1] => https://www.mmowg.net/wp-content/uploads/2020/11/a8Tnv1kVyXY.jpg [2] => https://www.mmowg.net/wp-content/uploads/2020/11/a8Tnv1kVyXY.jpg [3] => https://www.mmowg.net/wp-content/uploads/2020/11/a8Tnv1kVyXY.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:
56.09 ms | 406 KiB | 5 Q