3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'itemA' => [ 'product_id' => 1, 'category_id' => 1, ], 'itemB' => [ 'product_id' => 2, 'category_id' => 2, ], 'itemC' => [ 'product_id' => 3, 'category_id' => 1, ], 'itemE' => [ 'product_id' => 4, 'category_id' => 1, ], 'itemD' => [ 'product_id' => 5, 'category_id' => 2, ], ]; uasort($arr, function ($a, $b) { if ($a['category_id'] == $b['category_id']) { return $a['product_id'] - $b['product_id']; } return $a['category_id'] < $b['category_id'] ? -1 : 1; }); var_dump($arr);

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.140.0140.00717.56
8.4.130.0070.00618.51
8.4.120.0020.00823.91
8.4.110.0150.00718.87
8.4.100.0150.00618.88
8.4.90.0080.01220.59
8.4.80.0080.01018.70
8.4.70.0050.00317.84
8.4.60.0110.01018.84
8.4.50.0120.00919.32
8.4.40.0080.01119.43
8.4.30.0160.00322.38
8.4.20.0100.01018.71
8.4.10.0100.00719.74
8.3.270.0130.00716.45
8.3.260.0040.00416.79
8.3.250.0050.00519.15
8.3.240.0120.00516.89
8.3.230.0050.00316.85
8.3.220.0110.00918.93
8.3.210.0120.00716.55
8.3.200.0060.00416.66
8.3.190.0130.00617.09
8.3.180.0100.00716.63
8.3.170.0140.00417.05
8.3.160.0120.00618.54
8.3.150.0100.01018.96
8.3.140.0030.00916.64
8.3.130.0110.01118.39
8.3.120.0090.00018.93
8.3.110.0160.00320.94
8.3.100.0100.01024.06
8.3.90.0180.00026.77
8.3.80.0060.00317.97
8.3.70.0150.00016.63
8.3.60.0140.00418.56
8.3.50.0090.00718.15
8.3.40.0040.01118.49
8.3.30.0080.01118.59
8.3.20.0100.00020.57
8.3.10.0000.00820.41
8.3.00.0000.00820.68
8.2.290.0100.00720.75
8.2.280.0130.00818.62
8.2.270.0130.00617.22
8.2.260.0050.00318.56
8.2.250.0120.00618.24
8.2.240.0060.00317.16
8.2.230.0000.00822.58
8.2.220.0000.00937.54
8.2.210.0070.00026.77
8.2.200.0070.00316.75
8.2.190.0110.00418.27
8.2.180.0120.00318.36
8.2.170.0060.01222.96
8.2.160.0060.00920.38
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0000.00826.16
8.2.120.0040.00420.76
8.2.110.0060.00322.13
8.2.100.0100.00317.72
8.2.90.0040.00417.63
8.2.80.0030.00618.92
8.2.70.0050.00317.75
8.2.60.0060.00317.63
8.2.50.0080.00017.63
8.2.40.0000.00819.31
8.2.30.0070.00019.30
8.2.20.0040.00418.15
8.2.10.0000.00719.57
8.2.00.0000.00818.01
8.1.330.0100.01022.18
8.1.320.0090.01217.85
8.1.310.0070.01118.20
8.1.300.0060.00317.87
8.1.290.0040.00430.84
8.1.280.0090.00925.92
8.1.270.0080.00020.07
8.1.260.0040.00426.35
8.1.250.0090.00028.09
8.1.240.0030.00723.92
8.1.230.0070.00422.08
8.1.220.0040.00417.79
8.1.210.0080.00018.77
8.1.200.0040.00417.35
8.1.190.0030.00617.23
8.1.180.0000.00818.10
8.1.170.0030.00518.59
8.1.160.0040.00418.76
8.1.150.0080.00018.87
8.1.140.0070.00020.20
8.1.130.0030.00320.20
8.1.120.0030.00417.37
8.1.110.0000.01017.48
8.1.100.0000.00817.53
8.1.90.0000.00717.36
8.1.80.0040.00417.51
8.1.70.0030.00517.48
8.1.60.0080.00017.48
8.1.50.0040.00417.49
8.1.40.0050.00217.57
8.1.30.0040.00417.54
8.1.20.0030.00617.55
8.1.10.0040.00417.60
8.1.00.0040.00417.54
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0050.00318.39
8.0.270.0000.00717.10
8.0.260.0030.00318.30
8.0.250.0030.00316.78
8.0.240.0060.00016.87
8.0.230.0000.00716.91
8.0.220.0000.00716.88
8.0.210.0000.00716.77
8.0.200.0000.00716.93
8.0.190.0060.00316.98
8.0.180.0030.00516.94
8.0.170.0030.00616.93
8.0.160.0070.00016.94
8.0.150.0040.00416.87
8.0.140.0070.00016.76
8.0.130.0060.00013.26
8.0.120.0040.00416.85
8.0.110.0030.00516.85
8.0.100.0000.00716.84
8.0.90.0040.00416.75
8.0.80.0060.00916.93
8.0.70.0050.00316.84
8.0.60.0040.00416.76
8.0.50.0030.00516.83
8.0.30.0120.00817.10
8.0.20.0100.01116.92
8.0.10.0040.00416.93
8.0.00.0100.01116.89
7.4.330.0000.00515.55
7.4.320.0000.00616.52
7.4.300.0030.00316.53
7.4.290.0040.00416.61
7.4.280.0050.00316.56
7.4.270.0070.00016.52
7.4.260.0000.00716.59
7.4.250.0040.00416.54
7.4.240.0000.00716.57
7.4.230.0000.00716.35
7.4.220.0040.00416.67
7.4.210.0080.01016.63
7.4.200.0080.00016.50
7.4.160.0080.01016.38
7.4.140.0110.00717.86
7.4.130.0070.01016.62
7.4.120.0130.00916.61
7.4.110.0110.01016.37
7.4.100.0070.01016.49
7.4.90.0070.01016.52
7.4.80.0110.00719.39
7.4.70.0040.01516.56
7.4.60.0070.01016.59
7.4.50.0030.01016.39
7.4.40.0070.01516.45
7.4.00.0090.00615.18
7.3.330.0000.00513.30
7.3.320.0050.00013.31
7.3.310.0040.00416.34
7.3.300.0030.00316.14
7.3.290.0080.00016.21
7.3.280.0060.00916.23
7.3.260.0120.01016.41
7.3.240.0080.01116.42
7.3.230.0080.00816.36
7.3.210.0030.01416.20
7.3.200.0110.00616.31
7.3.190.0150.00316.34
7.3.180.0100.00716.48
7.3.170.0060.01616.30
7.3.160.0130.01016.38
7.3.20.0780.00514.72
7.3.10.0140.00614.69
7.3.00.0070.00714.75
7.2.330.0110.00716.64
7.2.320.0090.01516.36
7.2.310.0070.01016.58
7.2.300.0070.01016.46
7.2.290.0090.01216.74
7.2.150.0500.00714.81
7.2.140.0770.01015.11
7.2.130.0610.01114.89
7.2.120.0630.00615.03
7.2.110.0640.00614.77
7.2.100.0680.01015.13
7.2.90.0690.00715.09
7.2.80.0710.00614.88
7.2.70.0560.01314.98
7.2.60.1270.00314.82
7.2.50.0770.00315.16
7.2.40.0760.00315.04
7.2.30.0760.00315.08
7.2.20.0960.00315.16
7.2.10.0750.01014.97
7.2.00.0670.00714.86
7.1.250.0770.00013.82

preferences:
31.36 ms | 403 KiB | 5 Q