3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('display_errors', 1); error_reporting(E_ALL); $db_results = array( array('cat' => 1, 'id' => 1), array('cat' => 1, 'id' => 2), array('cat' => 2, 'id' => 3), array('cat' => 1, 'id' => 4) ); $category_map = []; foreach ( $db_results as $row ) { $category_map[ $row['cat'] ][ $row['id'] ] = $row; } print_r($category_map);

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.3.60.0100.01018.30
8.3.50.0210.00722.11
8.3.40.0160.00318.79
8.3.30.0070.00718.80
8.3.20.0040.00420.25
8.3.10.0080.00021.98
8.3.00.0080.00022.14
8.2.180.0060.01216.32
8.2.170.0210.00022.96
8.2.160.0070.00720.52
8.2.150.0000.00724.18
8.2.140.0000.00824.66
8.2.130.0100.00326.16
8.2.120.0090.00019.25
8.2.110.0040.00420.57
8.2.100.0110.00017.84
8.2.90.0040.00419.17
8.2.80.0050.00317.97
8.2.70.0060.00317.50
8.2.60.0000.00919.66
8.2.50.0040.00418.16
8.2.40.0000.00820.59
8.2.30.0000.00821.10
8.2.20.0050.00317.63
8.2.10.0000.00717.74
8.2.00.0000.00717.73
8.1.280.0190.00025.92
8.1.270.0040.00422.05
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0000.00922.21
8.1.230.0090.00317.89
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0040.00417.35
8.1.190.0040.00417.36
8.1.180.0040.00418.10
8.1.170.0000.00818.45
8.1.160.0040.00418.85
8.1.150.0040.00420.03
8.1.140.0060.00317.50
8.1.130.0040.00417.84
8.1.120.0050.00317.40
8.1.110.0030.00517.50
8.1.100.0040.00417.48
8.1.90.0040.00417.32
8.1.80.0000.00717.37
8.1.70.0070.00017.46
8.1.60.0070.00017.66
8.1.50.0030.00617.48
8.1.40.0050.00217.38
8.1.30.0050.00317.70
8.1.20.0040.00417.69
8.1.10.0040.00417.43
8.1.00.0030.00517.46
8.0.300.0070.00018.77
8.0.290.0070.00016.63
8.0.280.0040.00418.39
8.0.270.0030.00517.18
8.0.260.0000.00816.88
8.0.250.0030.00316.89
8.0.240.0090.00016.86
8.0.230.0070.00016.96
8.0.220.0000.00716.80
8.0.210.0000.00616.88
8.0.200.0000.00616.97
8.0.190.0050.00316.86
8.0.180.0040.00316.82
8.0.170.0040.00416.85
8.0.160.0040.00416.85
8.0.150.0040.00416.89
8.0.140.0050.00316.86
8.0.130.0060.00013.30
8.0.120.0080.00016.83
8.0.110.0070.00016.86
8.0.100.0040.00416.96
8.0.90.0030.00516.86
8.0.80.0080.00816.84
8.0.70.0000.00716.77
8.0.60.0080.00016.77
8.0.50.0040.00416.78
8.0.30.0060.01316.90
8.0.20.0110.01317.40
8.0.10.0000.00917.03
8.0.00.0090.00916.68
7.4.330.0060.00015.03
7.4.320.0030.00316.51
7.4.300.0080.00016.50
7.4.290.0000.00816.45
7.4.280.0000.00716.51
7.4.270.0000.00716.51
7.4.260.0000.00716.57
7.4.250.0040.00416.38
7.4.240.0050.00216.53
7.4.230.0030.00316.66
7.4.220.0100.00716.57
7.4.210.0070.01016.57
7.4.200.0000.00716.67
7.4.190.0030.00316.42
7.4.160.0180.00316.49
7.4.150.0090.00917.40
7.4.140.0070.01117.86
7.4.130.0110.00816.49
7.4.120.0060.01016.55
7.4.110.0090.01216.55
7.4.100.0060.01216.41
7.4.90.0070.01016.42
7.4.80.0120.00619.39
7.4.70.0040.01416.51
7.4.60.0120.00316.45
7.4.50.0050.00516.32
7.4.40.0090.00622.77
7.4.30.0160.00616.42
7.4.00.0030.01315.14
7.3.330.0030.00313.09
7.3.320.0030.00313.25
7.3.310.0040.00416.17
7.3.300.0060.00016.25
7.3.290.0030.01016.36
7.3.280.0080.01016.34
7.3.270.0130.00417.40
7.3.260.0210.00316.34
7.3.250.0100.00716.42
7.3.240.0000.01616.70
7.3.230.0130.00316.50
7.3.210.0110.00616.56
7.3.200.0060.01519.39
7.3.190.0120.00416.31
7.3.180.0080.00816.33
7.3.170.0060.00916.30
7.3.160.0110.00516.41
7.3.120.0110.00714.98
7.3.10.0060.00816.76
7.3.00.0070.00516.73
7.2.330.0090.00916.65
7.2.320.0140.00416.70
7.2.310.0180.00016.81
7.2.300.0060.01016.73
7.2.290.0170.00016.60
7.2.130.0050.00916.97
7.2.120.0090.00416.91
7.2.110.0100.00416.84
7.2.100.0030.00716.96
7.2.90.0050.00716.98
7.2.80.0060.00916.87
7.2.70.0060.00916.96
7.2.60.0060.00716.92
7.2.50.0070.00616.97
7.2.40.0050.01017.04
7.2.30.0100.00217.06
7.2.20.0070.00616.90
7.2.10.0080.00316.96
7.2.00.0010.01117.72
7.1.250.0070.00515.96
7.1.200.0030.01015.91
7.1.100.0030.00918.04
7.1.70.0030.01216.79
7.1.60.0100.01419.82
7.1.50.0060.01917.11
7.1.00.0030.07322.43
7.0.200.0150.00316.61
7.0.140.0070.07022.21
7.0.60.0070.06319.92
7.0.50.0030.07317.95
7.0.40.0030.05720.28
7.0.30.0370.07320.18
7.0.20.0300.04320.20
7.0.10.0170.05020.19
7.0.00.0070.04720.24
5.6.210.0170.07020.70
5.6.200.0070.08018.29
5.6.190.0030.04320.53
5.6.180.3630.04020.47
5.6.170.0300.07020.54
5.6.160.0030.06020.52
5.6.150.0130.04718.27
5.6.140.0030.05718.19
5.6.130.0100.05718.15
5.6.120.0000.05321.13
5.6.110.0100.08721.01
5.6.100.0130.05720.97
5.6.90.0170.08020.95
5.6.80.0070.04320.28
5.6.70.4270.03320.39
5.5.350.0030.08020.46
5.5.340.0000.04718.02
5.5.330.0100.04020.27
5.5.320.0330.07320.19
5.5.310.0230.08020.36
5.5.300.0170.07017.93
5.5.290.0030.05017.94
5.5.280.0100.07020.87
5.5.270.0070.09020.83
5.5.260.0070.06020.87
5.5.250.0030.04320.61
5.5.240.0170.04720.14
5.4.450.0000.06719.29
5.4.440.0700.06719.62
5.4.430.0130.05319.21
5.4.420.0100.05719.39
5.4.410.0070.05719.21
5.4.400.0100.05018.72
5.4.390.0070.05318.59
5.4.380.0330.05018.74
5.4.370.0370.04318.62
5.4.360.0200.05718.53
5.4.350.0200.05318.81
5.4.340.0170.05318.78
5.4.320.0050.04012.48
5.4.310.0040.04812.48
5.4.300.0100.03412.48
5.4.290.0060.03712.48
5.4.280.0060.03512.38
5.4.270.0130.05018.75
5.4.260.0170.06718.84
5.4.250.0070.05718.83
5.4.240.0130.05318.93
5.4.230.0030.06319.02
5.4.220.0100.08018.90
5.4.210.0100.07018.94
5.4.200.0200.05018.96
5.4.190.0100.07018.94
5.4.180.0130.06718.95
5.4.170.0000.06718.75
5.4.160.0100.06018.79
5.4.150.0100.06018.98
5.4.140.0170.05016.38
5.4.130.0230.04016.37
5.4.120.0030.07716.57
5.4.110.0130.07316.52
5.4.100.0130.04316.51
5.4.90.0030.05316.52
5.4.80.0070.05716.48
5.4.70.0100.07316.34
5.4.60.0100.04716.43
5.4.50.0100.05016.47
5.4.40.0130.06716.54
5.4.30.0170.04016.29
5.4.20.0170.05716.37
5.4.10.0130.05316.38
5.4.00.0030.07015.72
5.3.290.0060.04412.80
5.3.280.0070.05314.61
5.3.270.0130.05314.48
5.3.260.0030.05714.59
5.3.250.0170.04014.48
5.3.240.0100.04314.61
5.3.230.0070.07014.44
5.3.220.0070.05314.42
5.3.210.0200.05014.27
5.3.200.0030.05314.72
5.3.190.0070.05014.72
5.3.180.0100.05714.61
5.3.170.0130.04714.43
5.3.160.0100.06714.58
5.3.150.0070.05014.43
5.3.140.0030.05314.71
5.3.130.0000.06014.39
5.3.120.0100.05314.70
5.3.110.0170.06314.70
5.3.100.0030.05314.05
5.3.90.0100.06713.89
5.3.80.0000.05314.02
5.3.70.0130.06013.89
5.3.60.0070.06014.15
5.3.50.0130.05314.00
5.3.40.0130.04713.82
5.3.30.0100.05013.61
5.3.20.0070.05013.63
5.3.10.0130.04013.50
5.3.00.0200.05713.53
5.2.170.0070.05011.05
5.2.160.0000.04710.90
5.2.150.0070.05311.16
5.2.140.0100.04310.90
5.2.130.0000.04711.02
5.2.120.0100.05011.11
5.2.110.0030.04011.02
5.2.100.0130.05011.02
5.2.90.0070.04010.98
5.2.80.0100.04011.21
5.2.70.0070.04011.02
5.2.60.0070.03711.16
5.2.50.0030.05711.04
5.2.40.0030.04711.11
5.2.30.0030.04010.99
5.2.20.0100.03710.96
5.2.10.0030.04010.93
5.2.00.0030.04710.56
5.1.60.0000.0379.76
5.1.50.0030.03710.08
5.1.40.0030.0379.87
5.1.30.0030.05010.09
5.1.20.0030.03710.34
5.1.10.0030.05310.11
5.1.00.0100.04310.00
5.0.50.0000.0378.49
5.0.40.0000.0438.30
5.0.30.0030.0478.28
5.0.20.0070.0238.12
5.0.10.0070.0378.16
5.0.00.0070.0538.01
4.4.90.0100.0236.90
4.4.80.0000.0236.90
4.4.70.0070.0176.90
4.4.60.0070.0236.90
4.4.50.0030.0306.90
4.4.40.0000.0376.90
4.4.30.0030.0206.90
4.4.20.0070.0336.90
4.4.10.0000.0236.90
4.4.00.0030.0436.90
4.3.110.0070.0176.90
4.3.100.0070.0206.90
4.3.90.0070.0176.90
4.3.80.0100.0336.90
4.3.70.0000.0236.90
4.3.60.0070.0176.90
4.3.50.0030.0206.90
4.3.40.0000.0406.90
4.3.30.0070.0176.90
4.3.20.0000.0276.90
4.3.10.0000.0236.90
4.3.00.0030.0206.36

preferences:
47.93 ms | 400 KiB | 5 Q