3v4l.org

run code in 500+ PHP versions simultaneously
<?php $needles = ['a','c','r','r']; $haystacks = ['carr','car','arc','ra','c','abc','do','aa','rr', 'rrr']; $result = []; foreach ($haystacks as $i => $haystack) { foreach ($needles as $needle) { $haystack = preg_replace("/$needle/", '', $haystack, 1); } if (!$haystack) { $result[] = $haystacks[$i]; } } var_export($result);
Output for rfc.property-hooks, git.master, git.master_jit
array ( 0 => 'carr', 1 => 'car', 2 => 'arc', 3 => 'ra', 4 => 'c', 5 => 'rr', )

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:
50.76 ms | 1265 KiB | 4 Q