3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<a href="http://www.mydomain.com/galeria/thumbnails.php?album=774" target="_blank"><img alt="/" src="http://img255.imageshack.us/img00/000/000001.png" height="133" width="113"></a>'; $doc = new DOMDocument; $doc->loadHTML( $html); $results = array(); foreach( $doc->getElementsByTagName( 'a') as $a) { // If there are no children, continue on if( !$a->hasChildNodes()) continue; // Find the child <img> tag, if it exists foreach( $a->childNodes as $child) { if( $child->nodeType == XML_ELEMENT_NODE && $child->tagName == 'img') { // Now we have the <a> tag in $a and the <img> tag in $child // Get the information we need: parse_str( parse_url( $a->getAttribute('href'), PHP_URL_QUERY), $a_params); $results[] = array( $a_params['album'], $child->getAttribute('src')); } } } print_r( $results);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => 774 [1] => http://img255.imageshack.us/img00/000/000001.png ) )

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