3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $rand = range(0, 50); shuffle($rand); $rand2 = range(0, 50); shuffle($rand2); $arr = array_combine($rand, $rand2); $arr = array_filter($arr,function($k){ return $k <= 15 && $k >= 10; },2); sort($arr); foreach($arr as $key => $value) { echo "$key: $value\n"; }
based on DHGvG
Output for 7.1.0
0: 3 1: 7 2: 19 3: 22 4: 43 5: 46
Output for 7.0.14
0: 2 1: 11 2: 12 3: 14 4: 31 5: 43
Output for 7.0.6
0: 7 1: 12 2: 22 3: 40 4: 42 5: 49
Output for 7.0.5
0: 11 1: 19 2: 25 3: 26 4: 38 5: 41
Output for 7.0.4
0: 2 1: 14 2: 21 3: 26 4: 46 5: 49
Output for 7.0.3
0: 3 1: 14 2: 20 3: 29 4: 37 5: 50
Output for 7.0.2
0: 5 1: 28 2: 29 3: 33 4: 34 5: 38
Output for 7.0.1
0: 2 1: 6 2: 21 3: 23 4: 39 5: 43
Output for 7.0.0
0: 5 1: 7 2: 21 3: 23 4: 24 5: 38
Output for hhvm-3.12.0
0: 8 1: 27 2: 32 3: 43 4: 45 5: 48
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.28
0: 18 1: 19 2: 27 3: 29 4: 38 5: 43
Output for 5.6.21
0: 1 1: 12 2: 22 3: 30 4: 41 5: 43
Output for 5.6.20
0: 12 1: 22 2: 27 3: 30 4: 36 5: 41
Output for 5.6.19
0: 4 1: 11 2: 13 3: 20 4: 30 5: 42
Output for 5.6.18
0: 6 1: 9 2: 23 3: 29 4: 32 5: 50
Output for 5.6.17
0: 17 1: 18 2: 20 3: 22 4: 44 5: 47
Output for 5.6.16
0: 7 1: 24 2: 35 3: 44 4: 45 5: 50
Output for 5.6.15
0: 10 1: 23 2: 24 3: 27 4: 43 5: 45
Output for 5.6.14
0: 11 1: 13 2: 16 3: 28 4: 39 5: 45
Output for 5.6.13
0: 12 1: 19 2: 24 3: 33 4: 35 5: 45
Output for 5.6.12
0: 8 1: 12 2: 15 3: 18 4: 19 5: 48
Output for 5.6.11
0: 6 1: 14 2: 17 3: 19 4: 35 5: 45
Output for 5.6.10
0: 7 1: 8 2: 9 3: 15 4: 17 5: 31
Output for 5.6.9
0: 0 1: 5 2: 13 3: 25 4: 39 5: 42
Output for 5.6.8
0: 5 1: 8 2: 13 3: 16 4: 33 5: 43
Output for 5.6.7
0: 16 1: 19 2: 27 3: 34 4: 43 5: 47
Output for 5.3.0 - 5.5.35
Warning: array_filter() expects at most 2 parameters, 3 given in /in/tQkQu on line 10 Warning: sort() expects parameter 1 to be array, null given in /in/tQkQu on line 11 Warning: Invalid argument supplied for foreach() in /in/tQkQu on line 13
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/tQkQu on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/tQkQu on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/tQkQu on line 10
Process exited with code 255.