3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
based on KeME5
Output for 7.0.0 - 7.2.0
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.4.11 - 5.6.28
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] => & )
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/X5UsT on line 6
Process exited with code 255.