3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_group(array $array, callable|string $callback): array { $groups = []; if (!is_callable($callback)) { return $groups; } foreach ($array as $key => $value) { $groups[call_user_func($callback, $value)][$key] = $value; } return $groups; } $people = [ ["name" => "Billy Jean", "filter" => false], ["name" => "Ronald Reagan", "filter" => true], ["name" => "Bill Clinton", "filter" => true], ["name" => "Michael Jackson", "filter" => false], ["name" => "Johnny Cash", "filter" => false], ]; var_export( array_group( $people, fn($p) => substr($p["name"], 0, 4) ) );

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.120.0060.00420.53
8.4.110.0040.00522.40
8.4.100.0120.00917.90
8.4.90.0050.00518.02
8.4.80.0080.00718.09
8.4.70.0120.00819.64
8.4.60.0100.00118.80
8.4.50.0130.00719.46
8.4.40.0170.00319.54
8.4.30.0100.01020.54
8.4.20.0030.01017.55
8.4.10.0130.00621.97
8.3.250.0090.00518.88
8.3.240.0100.00918.88
8.3.230.0060.00316.69
8.3.220.0070.00117.07
8.3.210.0100.01016.80
8.3.200.0140.00516.73
8.3.190.0120.00818.89
8.3.180.0120.00816.54
8.3.170.0120.00616.54
8.3.160.0110.00716.38
8.3.150.0050.00317.27
8.3.140.0090.00918.86
8.3.130.0080.00018.38
8.3.120.0060.00320.82
8.3.110.0130.00616.50
8.3.100.0120.01224.06
8.3.90.0080.00026.77
8.3.80.0050.00518.31
8.3.70.0120.00316.58
8.3.60.0190.00318.39
8.3.50.0040.01120.32
8.3.40.0070.00721.90
8.3.30.0060.00918.92
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0070.00026.16
8.2.290.0060.00220.49
8.2.280.0050.00318.16
8.2.270.0100.01016.39
8.2.260.0130.00318.93
8.2.250.0000.00816.82
8.2.240.0120.00318.73
8.2.230.0120.00420.94
8.2.220.0080.00437.54
8.2.210.0080.00026.77
8.2.200.0030.00616.88
8.2.190.0130.01016.88
8.2.180.0100.01025.92
8.2.170.0040.01122.96
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0000.00819.66
8.2.110.0040.00421.98
8.2.100.0060.00618.22
8.2.90.0030.00517.75
8.2.80.0000.00817.97
8.2.70.0030.00517.63
8.2.60.0000.00817.75
8.2.50.0000.00818.04
8.2.40.0050.00320.07
8.2.30.0080.00018.16
8.2.20.0030.00520.60
8.2.10.0040.00418.14
8.2.00.0020.00519.32
8.1.330.0080.01023.64
8.1.320.0110.00816.09
8.1.310.0040.00416.57
8.1.300.0060.01019.77
8.1.290.0050.00530.84
8.1.280.0070.00725.92
8.1.270.0000.00823.99
8.1.260.0060.00326.35
8.1.250.0070.00028.09
8.1.240.0150.00022.10
8.1.230.0070.00319.14
8.1.220.0050.00317.78
8.1.210.0050.00318.77
8.1.200.0000.01017.47
8.1.190.0060.00317.35
8.1.180.0000.00818.10
8.1.170.0040.00417.62
8.1.160.0000.00718.96
8.1.150.0060.00318.62
8.1.140.0040.00417.52
8.1.130.0030.00318.91
8.1.120.0080.00017.52
8.1.110.0040.00417.49
8.1.100.0000.00717.36
8.1.90.0040.00417.49
8.1.80.0110.00017.41
8.1.70.0040.00917.27
8.1.60.0040.00817.61
8.1.50.0060.00617.52
8.1.40.0100.00317.41
8.1.30.0150.00217.61
8.1.20.0160.00417.49
8.1.10.0130.00317.36
8.1.00.0000.01417.32
8.0.300.0000.00719.64
8.0.290.0000.00816.75
8.0.280.0000.00818.48
8.0.270.0030.00316.95
8.0.260.0030.00318.41
8.0.250.0050.00217.05
8.0.240.0000.00717.04
8.0.230.0000.00717.07
8.0.220.0070.00016.95
8.0.210.0070.00716.81
8.0.200.0120.00317.02
8.0.190.0130.00317.01
8.0.180.0130.00316.99
8.0.170.0130.00316.88
8.0.160.0080.00816.83
8.0.150.0170.00016.93
8.0.140.0100.00516.88
8.0.130.0100.00516.86
8.0.120.0100.00516.92
8.0.110.0110.00316.98
8.0.100.0050.01016.97
8.0.90.0140.00317.01
8.0.80.0110.00516.87
8.0.70.0090.00616.84
8.0.60.0130.00316.91
8.0.50.0120.00316.85
8.0.30.0100.00516.89
8.0.20.0070.00717.07
8.0.10.0120.00416.97
7.4.330.0050.00015.55
7.4.320.0000.00716.31
7.4.300.0060.00316.27
7.4.290.0040.01316.25
7.4.280.0110.00416.27
7.4.270.0120.00316.31
7.4.260.0160.00416.39
7.4.250.0190.00016.26
7.4.240.0150.00316.39
7.4.230.0180.00016.32
7.4.220.0110.00516.42
7.4.210.0140.00216.41
7.4.200.0120.00416.30
7.4.190.0120.00316.48
7.4.180.0120.00416.39
7.4.160.0090.00616.51
7.4.150.0090.00616.36
7.4.140.0100.00516.21
7.4.130.0040.00916.20
7.4.120.0130.00216.11
7.4.110.0100.00516.26
7.4.100.0040.01116.34
7.4.90.0080.00816.30
7.4.80.0090.00316.19
7.4.70.0120.00016.22
7.4.60.0070.00316.16
7.4.50.0050.00516.19
7.4.40.0050.00515.96
7.4.30.0060.00215.91
7.4.20.0030.00515.80
7.4.10.0040.00416.13
7.4.00.0050.00515.96

preferences:
28.5 ms | 403 KiB | 5 Q