3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="description" content="a descrição do seu site em no máximo 90 caracteres"> <meta name="keywords" content="escreva palavras-chaves curtas, máximo 150 caracteres"> <title>Título do Documento</title> </head> <body> <!-- Aqui fica a página que será visível para todos, onde pode-se inserir textos, imagens, links para outras páginas, etc, geralmente usa-se: --> <div>Tag para criar-se uma 'caixa', um bloco, mais utilizada com "Cascading Style Sheets (Folhas de Estilo em Cascata)</div> <span>Tag para modificação de uma parte do texto da página</span> <img src="endereço_de_uma_imagem.jpg" /> <a href="http://www.wikipedia.org">Wikipedia, A Enciclopédia Livre</a> <a href="http://www.exemplo.org/pasta/subpasta/">Pasta e subpasta</a> </body> HTML; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXpath($doc); $elements = $xpath->query("//a[contains(@href,'pasta/subpasta')]"); foreach($elements as $domNode) { var_dump($domNode); }
Output for git.master, git.master_jit, rfc.property-hooks
object(DOMElement)#3 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(1) "a" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> NULL ["nodeName"]=> string(1) "a" ["nodeValue"]=> string(16) "Pasta e subpasta" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "a" ["baseURI"]=> NULL ["textContent"]=> string(16) "Pasta e subpasta" }

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:
57.5 ms | 403 KiB | 8 Q