3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <p class="Heading1-P"> <span class="Heading1-H">Chapter 1</span> </p> <p class="Normal-P"> <span class="Normal-H">This is chapter 1</span> </p> <p class="Heading1-P"> <span class="Heading1-H">Chapter 2</span> </p> <p class="Normal-P"> <span class="Normal-H">This is chapter 2</span> </p> <p class="Heading1-P"> <span class="Heading1-H">Chapter 3</span> </p> <p class="Normal-P"> <span class="Normal-H">This is chapter 3</span> </p> HTML; $dom = new DOMDocument(); $dom->loadHTML($html); $xpath = new DOMXPath($dom); foreach (['Heading1-H', 'Normal-H'] as $class) { var_export( array_column( iterator_to_array($xpath->query("//*[@class='$class']/text()")), 'nodeValue' ) ); echo "\n---\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'Chapter 1', 1 => 'Chapter 2', 2 => 'Chapter 3', ) --- array ( 0 => 'This is chapter 1', 1 => 'This is chapter 2', 2 => 'This is chapter 3', ) ---

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:
85.75 ms | 405 KiB | 5 Q