3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $body = '<div class="cModule myphotos"> <h3><span>My photos</span></h3> <ul class="cResetList cThumbList clrfix"> <li> <a href="/projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=67" hidefocus="true" style="outline: none;"><img class="cAvatar jomNameTips cAvatar-sidebar" title="Uploaded by shine s" src="http://107.20.167.165/projects/mysportsjam/images/photos/103/12/thumb_05c0beeb8f0f32a08538dad7.jpg" alt="shine s"></a> </li> <li> <a href="/projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=43" hidefocus="true" style="outline: none;"><img class="cAvatar jomNameTips cAvatar-sidebar" src="http://107.20.167.165/projects/mysportsjam/images/photos/103/12/thumb_c122ff8dafd2edeba377a1cd.jpg" alt="shine s" original-title="Uploaded by shine s"></a> </li> <li> <a href="/projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=66" hidefocus="true" style="outline: none;"><img class="cAvatar jomNameTips cAvatar-sidebar" title="Uploaded by shine s" src="http://107.20.167.165/projects/mysportsjam/images/photos/103/12/thumb_9414b5dff6c8644d197ff684.jpg" alt="shine s"></a> </li> </ul> <div class="app-box-footer"> <a href="/projects/mysportsjam/index.php/joom-social/103-shine/photos" hidefocus="true" style="outline: none;">View all photos</a> </div> </div>'; $xml = new DOMDocument(); $xml->loadHTML($body); $nodes = $xml->getElementsByTagName('li'); for($curr = 0; $curr < $nodes->length; $curr++) { $li = $nodes->item($curr); $innerHTML= ''; $children = $li->childNodes; foreach ($children as $child) { $innerHTML .= $child->ownerDocument->saveXML( $child ); } print $innerHTML; foreach($li->childNodes as $child) { $a = $child; if(is_a($a, "DOMElement")) { $href = $a->getAttribute('href'); print "{$href}\n"; } } print "\n"; }
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<a href="/projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=67" hidefocus="true" style="outline: none;"><img class="cAvatar jomNameTips cAvatar-sidebar" title="Uploaded by shine s" src="http://107.20.167.165/projects/mysportsjam/images/photos/103/12/thumb_05c0beeb8f0f32a08538dad7.jpg" alt="shine s"/></a> /projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=67 <a href="/projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=43" hidefocus="true" style="outline: none;"><img class="cAvatar jomNameTips cAvatar-sidebar" src="http://107.20.167.165/projects/mysportsjam/images/photos/103/12/thumb_c122ff8dafd2edeba377a1cd.jpg" alt="shine s" original-title="Uploaded by shine s"/></a> /projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=43 <a href="/projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=66" hidefocus="true" style="outline: none;"><img class="cAvatar jomNameTips cAvatar-sidebar" title="Uploaded by shine s" src="http://107.20.167.165/projects/mysportsjam/images/photos/103/12/thumb_9414b5dff6c8644d197ff684.jpg" alt="shine s"/></a> /projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=66
Output for 5.0.0 - 5.2.17
<a href="/projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=67" hidefocus="true" style="outline: none;"><img class="cAvatar jomNameTips cAvatar-sidebar" title="Uploaded by shine s" src="http://107.20.167.165/projects/mysportsjam/images/photos/103/12/thumb_05c0beeb8f0f32a08538dad7.jpg" alt="shine s"/></a> Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /in/Yr5M1 on line 43 Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /in/Yr5M1 on line 43 /projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=67 Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /in/Yr5M1 on line 43 <a href="/projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=43" hidefocus="true" style="outline: none;"><img class="cAvatar jomNameTips cAvatar-sidebar" src="http://107.20.167.165/projects/mysportsjam/images/photos/103/12/thumb_c122ff8dafd2edeba377a1cd.jpg" alt="shine s" original-title="Uploaded by shine s"/></a> Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /in/Yr5M1 on line 43 Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /in/Yr5M1 on line 43 /projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=43 Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /in/Yr5M1 on line 43 <a href="/projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=66" hidefocus="true" style="outline: none;"><img class="cAvatar jomNameTips cAvatar-sidebar" title="Uploaded by shine s" src="http://107.20.167.165/projects/mysportsjam/images/photos/103/12/thumb_9414b5dff6c8644d197ff684.jpg" alt="shine s"/></a> Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /in/Yr5M1 on line 43 Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /in/Yr5M1 on line 43 /projects/mysportsjam/index.php/joom-social/103-shine/photos/photo?albumid=12#photoid=66 Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /in/Yr5M1 on line 43
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/Yr5M1 on line 24
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/Yr5M1 on line 24