3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div> <h1>title</h1> and <h2>title 2</h2> <h2 data-formula="a > b" class="regex_is_DOM_unaware">Monkeywrench</h2> <h1 class="classname">test <span>This isn't even a </h tag</span></h1> </div> HTML; var_export( preg_match_all( '|<\s*h[1-2](?:.*)>(.*)</\s*h|Ui', $html, $matches ) ? $matches[1] // capture group 1 : [] ); /* Desired result but not what is provided: array ( 0 => 'title', 1 => 'title 2', 2 => 'Monkeywrench', 3 => 'test <span>This isn't even a </h tag</span>' ) */
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'title', 1 => 'title 2', 2 => ' b" class="regex_is_DOM_unaware">Monkeywrench', 3 => 'test <span>This isn\'t even a ', )

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