3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html=<<<HTML <html> <body> <table id="news" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="539" height="35"><span><strong>Info to Extract</strong></span></td> </tr> <tr> <td height="35" class="texto10">Martes, 02 de Octubre de 2012 | Autor: Trovert</td> </tr> <tr> <td height="35" class="texto12Gris"><p><strong>Info To extract</strong></p> <p><strong>&nbsp;</strong></p> <p><strong>Casa de Gobierno: (a 9 cuadras del hostel)</strong></p> <img title="title" src="../images/theimage.jpg" width="400" height="266" /> </td> </tr> </table> </body> </html> HTML; function walkNode($node) { $str=""; if($node->nodeType==XML_TEXT_NODE) { $str.=$node->nodeValue; } elseif(strtolower($node->nodeName)=="img") { $str.='<img src="'.$node->attributes->getNamedItem("src")->nodeValue.'" />'; } if($node->firstChild) $str.=walkNode($node->firstChild); if($node->nextSibling) $str.=walkNode($node->nextSibling); return $str; } $dom=new DOMDocument(); $dom->loadHTML($html); $xpath=new DOMXPath($dom); $tds=$xpath->query('//table[@id="news"]//tr[position()>0]/td'); foreach($tds as $td) { echo walkNode($td->firstChild); echo "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Info to Extract Martes, 02 de Octubre de 2012 | Autor: Trovert Info To extract   Casa de Gobierno: (a 9 cuadras del hostel) <img src="../images/theimage.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:
41.42 ms | 401 KiB | 8 Q