3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = 'in the middle 9850112686331(14-15) for Rocco A & Stephanie'; $arr = explode(' ', $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)) . PHP_EOL; } } usort($candidates, function($a, $b) { return strlen($b) - strlen($a); }); print_r($candidates);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Array ( [0] => in the middle 9850112686331(14-15) for Rocco A & Stephanie [1] => the middle 9850112686331(14-15) for Rocco A & Stephanie [2] => middle 9850112686331(14-15) for Rocco A & Stephanie [3] => in the middle 9850112686331(14-15) for Rocco A & [4] => in the middle 9850112686331(14-15) for Rocco A [5] => the middle 9850112686331(14-15) for Rocco A & [6] => in the middle 9850112686331(14-15) for Rocco [7] => 9850112686331(14-15) for Rocco A & Stephanie [8] => the middle 9850112686331(14-15) for Rocco A [9] => the middle 9850112686331(14-15) for Rocco [10] => middle 9850112686331(14-15) for Rocco A & [11] => middle 9850112686331(14-15) for Rocco A [12] => in the middle 9850112686331(14-15) for [13] => middle 9850112686331(14-15) for Rocco [14] => the middle 9850112686331(14-15) for [15] => in the middle 9850112686331(14-15) [16] => 9850112686331(14-15) for Rocco A & [17] => 9850112686331(14-15) for Rocco A [18] => the middle 9850112686331(14-15) [19] => middle 9850112686331(14-15) for [20] => 9850112686331(14-15) for Rocco [21] => middle 9850112686331(14-15) [22] => 9850112686331(14-15) for [23] => for Rocco A & Stephanie [24] => 9850112686331(14-15) [25] => Rocco A & Stephanie [26] => in the middle [27] => for Rocco A & [28] => A & Stephanie [29] => for Rocco A [30] => & Stephanie [31] => the middle [32] => for Rocco [33] => Rocco A & [34] => Stephanie [35] => Rocco A [36] => in the [37] => middle [38] => Rocco [39] => the [40] => for [41] => A & [42] => in [43] => A [44] => & )
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Array ( [0] => in the middle 9850112686331(14-15) for Rocco A & Stephanie [1] => the middle 9850112686331(14-15) for Rocco A & Stephanie [2] => middle 9850112686331(14-15) for Rocco A & Stephanie [3] => in the middle 9850112686331(14-15) for Rocco A & [4] => in the middle 9850112686331(14-15) for Rocco A [5] => the middle 9850112686331(14-15) for Rocco A & [6] => 9850112686331(14-15) for Rocco A & Stephanie [7] => in the middle 9850112686331(14-15) for Rocco [8] => the middle 9850112686331(14-15) for Rocco A [9] => the middle 9850112686331(14-15) for Rocco [10] => middle 9850112686331(14-15) for Rocco A & [11] => middle 9850112686331(14-15) for Rocco A [12] => in the middle 9850112686331(14-15) for [13] => middle 9850112686331(14-15) for Rocco [14] => the middle 9850112686331(14-15) for [15] => 9850112686331(14-15) for Rocco A & [16] => in the middle 9850112686331(14-15) [17] => 9850112686331(14-15) for Rocco A [18] => the middle 9850112686331(14-15) [19] => middle 9850112686331(14-15) for [20] => 9850112686331(14-15) for Rocco [21] => middle 9850112686331(14-15) [22] => 9850112686331(14-15) for [23] => for Rocco A & Stephanie [24] => 9850112686331(14-15) [25] => Rocco A & Stephanie [26] => A & Stephanie [27] => for Rocco A & [28] => in the middle [29] => & Stephanie [30] => for Rocco A [31] => the middle [32] => Rocco A & [33] => Stephanie [34] => for Rocco [35] => Rocco A [36] => in the [37] => middle [38] => Rocco [39] => for [40] => A & [41] => the [42] => in [43] => A [44] => & )
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Array ( [0] => in the middle 9850112686331(14-15) for Rocco A & Stephanie [1] => the middle 9850112686331(14-15) for Rocco A & Stephanie [2] => middle 9850112686331(14-15) for Rocco A & Stephanie [3] => in the middle 9850112686331(14-15) for Rocco A & [4] => in the middle 9850112686331(14-15) for Rocco A [5] => the middle 9850112686331(14-15) for Rocco A & [6] => 9850112686331(14-15) for Rocco A & Stephanie [7] => in the middle 9850112686331(14-15) for Rocco [8] => the middle 9850112686331(14-15) for Rocco A [9] => the middle 9850112686331(14-15) for Rocco [10] => middle 9850112686331(14-15) for Rocco A & [11] => middle 9850112686331(14-15) for Rocco A [12] => in the middle 9850112686331(14-15) for [13] => middle 9850112686331(14-15) for Rocco [14] => the middle 9850112686331(14-15) for [15] => in the middle 9850112686331(14-15) [16] => 9850112686331(14-15) for Rocco A & [17] => 9850112686331(14-15) for Rocco A [18] => the middle 9850112686331(14-15) [19] => middle 9850112686331(14-15) for [20] => 9850112686331(14-15) for Rocco [21] => middle 9850112686331(14-15) [22] => 9850112686331(14-15) for [23] => for Rocco A & Stephanie [24] => 9850112686331(14-15) [25] => Rocco A & Stephanie [26] => in the middle [27] => for Rocco A & [28] => A & Stephanie [29] => for Rocco A [30] => & Stephanie [31] => the middle [32] => Rocco A & [33] => Stephanie [34] => for Rocco [35] => Rocco A [36] => middle [37] => in the [38] => Rocco [39] => for [40] => A & [41] => the [42] => in [43] => A [44] => & )

preferences:
287.82 ms | 406 KiB | 329 Q