3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'moopuuuooze'; // The regex matches any character -> . in a capture group () // plus as much identical characters as possible following it -> \1+ $pattern = '/(.)\1+/'; preg_match_all($pattern, $string, $m); // sort by their length // sort by their length usort($m[0], 'length_sort'); function length_sort($a, $b) { return (strlen($a) < strlen($b)) ? 1 : -1; } echo "Longest sequence: " . $m[0][0] . "\n";
Output for git.master, git.master_jit, rfc.property-hooks
Longest sequence: uuu

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:
42.16 ms | 401 KiB | 8 Q