3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = 'in the middle 9850112686331(14-15): for Rocco A & Stephanie'; $arr = preg_split('/[^[:alnum:]]+/', $subject); $candidates = []; for ($i = 0; $i < count($arr); $i++) { for ($j = $i; $j < count($arr); $j++) { $candidates[] = implode(' ', array_slice($arr, $i, $j - $i + 1)); } } usort($candidates, function($a, $b) { return strlen($b) - strlen($a); }); foreach($candidates as $candidate){ echo $candidate . PHP_EOL; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
in the middle 9850112686331 14 15 for Rocco A Stephanie the middle 9850112686331 14 15 for Rocco A Stephanie middle 9850112686331 14 15 for Rocco A Stephanie in the middle 9850112686331 14 15 for Rocco A in the middle 9850112686331 14 15 for Rocco the middle 9850112686331 14 15 for Rocco A 9850112686331 14 15 for Rocco A Stephanie the middle 9850112686331 14 15 for Rocco middle 9850112686331 14 15 for Rocco A in the middle 9850112686331 14 15 for middle 9850112686331 14 15 for Rocco the middle 9850112686331 14 15 for in the middle 9850112686331 14 15 9850112686331 14 15 for Rocco A in the middle 9850112686331 14 the middle 9850112686331 14 15 middle 9850112686331 14 15 for 9850112686331 14 15 for Rocco in the middle 9850112686331 the middle 9850112686331 14 14 15 for Rocco A Stephanie middle 9850112686331 14 15 the middle 9850112686331 15 for Rocco A Stephanie middle 9850112686331 14 9850112686331 14 15 for for Rocco A Stephanie middle 9850112686331 9850112686331 14 15 14 15 for Rocco A Rocco A Stephanie 9850112686331 14 14 15 for Rocco 15 for Rocco A in the middle 9850112686331 15 for Rocco for Rocco A A Stephanie the middle 14 15 for for Rocco Stephanie Rocco A in the middle 15 for 14 15 Rocco the for in 14 15 A
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
in the middle 9850112686331 14 15 for Rocco A Stephanie the middle 9850112686331 14 15 for Rocco A Stephanie middle 9850112686331 14 15 for Rocco A Stephanie in the middle 9850112686331 14 15 for Rocco A in the middle 9850112686331 14 15 for Rocco the middle 9850112686331 14 15 for Rocco A 9850112686331 14 15 for Rocco A Stephanie the middle 9850112686331 14 15 for Rocco middle 9850112686331 14 15 for Rocco A in the middle 9850112686331 14 15 for middle 9850112686331 14 15 for Rocco the middle 9850112686331 14 15 for in the middle 9850112686331 14 15 9850112686331 14 15 for Rocco A the middle 9850112686331 14 15 in the middle 9850112686331 14 middle 9850112686331 14 15 for 9850112686331 14 15 for Rocco in the middle 9850112686331 the middle 9850112686331 14 14 15 for Rocco A Stephanie middle 9850112686331 14 15 15 for Rocco A Stephanie the middle 9850112686331 middle 9850112686331 14 9850112686331 14 15 for for Rocco A Stephanie middle 9850112686331 9850112686331 14 15 14 15 for Rocco A Rocco A Stephanie 9850112686331 14 14 15 for Rocco 15 for Rocco A 9850112686331 in the middle 15 for Rocco for Rocco A A Stephanie the middle for Rocco Stephanie 14 15 for Rocco A 15 for in the middle 14 15 Rocco for the 15 14 in A
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
in the middle 9850112686331 14 15 for Rocco A Stephanie the middle 9850112686331 14 15 for Rocco A Stephanie middle 9850112686331 14 15 for Rocco A Stephanie in the middle 9850112686331 14 15 for Rocco A in the middle 9850112686331 14 15 for Rocco the middle 9850112686331 14 15 for Rocco A 9850112686331 14 15 for Rocco A Stephanie the middle 9850112686331 14 15 for Rocco middle 9850112686331 14 15 for Rocco A in the middle 9850112686331 14 15 for middle 9850112686331 14 15 for Rocco the middle 9850112686331 14 15 for in the middle 9850112686331 14 15 9850112686331 14 15 for Rocco A middle 9850112686331 14 15 for in the middle 9850112686331 14 the middle 9850112686331 14 15 9850112686331 14 15 for Rocco the middle 9850112686331 14 14 15 for Rocco A Stephanie in the middle 9850112686331 middle 9850112686331 14 15 15 for Rocco A Stephanie the middle 9850112686331 middle 9850112686331 14 9850112686331 14 15 for for Rocco A Stephanie middle 9850112686331 9850112686331 14 15 Rocco A Stephanie 14 15 for Rocco A 9850112686331 14 14 15 for Rocco 15 for Rocco A 9850112686331 in the middle 15 for Rocco for Rocco A A Stephanie the middle for Rocco 14 15 for Stephanie Rocco A 15 for middle in the Rocco 14 15 the for in 15 14 A

preferences:
176.39 ms | 404 KiB | 193 Q