3v4l.org

run code in 300+ PHP versions simultaneously
<?php $htmls = [ "<p><div><p>aaaaaa</p></div></p>", "<div><p>aaaaaa</p></div>", "<p>aaaaaa</p><div>bbbbbb</div>", "<p>aaaaaa</p><div>bbbbbb</div><p>cccccc</p>", "<p>aaaaaa</p><p>bbbbbb</p>", "<p>hello<p>aaaaaa</p></p>", "<p><p>aaaaaa</p></p>" ]; foreach ($htmls as $i => $html) { $without_ptags = preg_replace('~<p>(?:(?R)|.*?)*</p>~', '', $html, 2, $count); if ($without_ptags === '' && $count == 1) { echo "$i => ", substr($html, 3, -4); }else{ echo "$i => not wrapped in p tags"; } echo "\n---\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
0 => <div><p>aaaaaa</p></div> --- 1 => not wrapped in p tags --- 2 => not wrapped in p tags --- 3 => not wrapped in p tags --- 4 => not wrapped in p tags --- 5 => hello<p>aaaaaa</p> --- 6 => <p>aaaaaa</p> ---

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:
37.78 ms | 406 KiB | 5 Q