3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = ' <div> <p>Lorem Ipsum1</p> <p>Lorem Ipsum2</p> <h2>Title</h2> <p>Lorem Ipsum3</p><!-- PHP gets this paragraph --> <p>Lorem Ipsum4</p> <h2>Title</h2> <p>Lorem Ipsum5</p> </div>'; $xml = simplexml_load_string($str); $headings = $xml->xpath('h2'); $contents = []; foreach ($headings as $heading) { $contents[] = (string)$heading->xpath('following-sibling::p')[0]; } var_dump($contents);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> string(12) "Lorem Ipsum3" [1]=> string(12) "Lorem Ipsum5" }

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