3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<p height="200px;"> <img alt="Fahrrad Alt-Tag" src="http://localhost/mediafiles/Bilder/diamant-e-bike.jpg" height="250px" style="float: left; width: 300px; height: 189px; margin-left: 10px; margin-right: 10px;"> <br> <div style="height:200px;"> <img alt="Fahrrad Alt-Tag" src="http://localhost/mediafiles/Bilder/diamant-e-bike.jpg" height="250px" style="float: left; width: 300px; height: 189px; margin-left: 10px; margin-right: 10px;" class="google"> </div>'; function e24_img_responsive($html) { /* preg_match_all("~<img\s*(?:style\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|class\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|src\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|alt\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|width\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|height\s*\=\s*[\'\"](.*?)[\'\"].*?\s*)+.*?>~", $html, $aImageTags); foreach($aImageTags[0] as $index => $string) { $new_string = $string; // style tag found if(!empty($aImageTags[1][$index])) { $new_string = preg_replace("~height:.*;~") } // class tag found if(!empty($aImageTags[2][$index])) { var_dump($aImageTags[2][$index]); } // height tag found if(!empty($aImageTags[6][$index])) { var_dump($aImageTags[6][$index]); } } */ $dom = new DOMDocument(); $dom->loadHTML($html); $images = $dom->getElementsByTagName('img'); while($img = $images->item($i++)) { foreach($img->attributes as $attr) { echo $attr->name . " " . $attr->value . "<br />"; } } } e24_img_responsive($str); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $i in /in/RoICZ on line 38 Deprecated: DOMNodeList::item(): Passing null to parameter #1 ($index) of type int is deprecated in /in/RoICZ on line 38 alt Fahrrad Alt-Tag<br />src http://localhost/mediafiles/Bilder/diamant-e-bike.jpg<br />height 250px<br />style float: left; width: 300px; height: 189px; margin-left: 10px; margin-right: 10px;<br />alt Fahrrad Alt-Tag<br />src http://localhost/mediafiles/Bilder/diamant-e-bike.jpg<br />height 250px<br />style float: left; width: 300px; height: 189px; margin-left: 10px; margin-right: 10px;<br />class google<br />

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