3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Here's the data: $json = json_decode('[ [{"id":1,"price":11900},{"id":2,"price":499},{"id":3,"price":2099}], [{"id":1,"price":11900},{"id":2,"price":499},{"id":4,"price":999}], [{"id":1,"price":11900},{"id":2,"price":499},{"id":5,"price":899}], [{"id":1,"price":11900},{"id":2,"price":499},{"id":6,"price":2999}] ]', true); // Calculate the sums for all prices up-front: $sums = array_map(fn($v) => array_sum(array_column($v, 'price')), $json); // Pass the sums into our key-based sorter: uksort($json, function($b, $a) use ($sums) { return $sums[$a] <=> $sums[$b]; }); // See the sums, get the sorted data: var_dump($sums, $json);

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.5.10.0120.00618.88
8.5.00.0110.00920.09
8.4.160.0080.00219.73
8.4.150.0010.00114.05
8.4.140.0160.00517.32
8.4.130.0150.00617.82
8.4.120.0050.00420.32
8.4.110.0130.01022.41
8.4.100.0080.01019.00
8.4.90.0040.00719.14
8.4.80.0080.00417.84
8.4.70.0150.00717.68
8.4.60.0130.00718.77
8.4.50.0100.01019.43
8.4.40.0100.01019.30
8.4.30.0030.00720.36
8.4.20.0120.00817.75
8.4.10.0110.00017.83
8.3.280.0130.00820.25
8.3.270.0110.01016.67
8.3.260.0070.01116.45
8.3.250.0140.00418.85
8.3.240.0100.00916.67
8.3.230.0110.00916.44
8.3.220.0090.00217.20
8.3.210.0140.00716.73
8.3.200.0050.00416.66
8.3.190.0100.00617.12
8.3.180.0140.00516.49
8.3.170.0030.01516.56
8.3.160.0040.01516.44
8.3.150.0070.01117.18
8.3.140.0050.00316.71
8.3.130.0040.00416.62
8.3.120.0060.01018.88
8.3.110.0000.00920.94
8.3.100.0040.00416.39
8.3.90.0080.00026.77
8.3.80.0090.00016.39
8.3.70.0090.00616.63
8.3.60.0040.01118.31
8.3.50.0040.01820.22
8.3.40.0110.01119.07
8.3.30.0000.01519.04
8.3.20.0050.00324.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.290.0110.00820.52
8.2.280.0080.01218.20
8.2.270.0110.00716.89
8.2.260.0030.01317.29
8.2.250.0060.00316.91
8.2.240.0030.00618.74
8.2.230.0080.00022.58
8.2.220.0060.00324.06
8.2.210.0080.00026.77
8.2.200.0060.01116.36
8.2.190.0100.01016.75
8.2.180.0120.00325.92
8.2.170.0170.00722.96
8.2.160.0070.01022.96
8.2.150.0050.00325.66
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0150.00019.76
8.2.110.0030.00620.32
8.2.100.0090.00019.36
8.1.330.0100.00922.09
8.1.320.0090.01015.87
8.1.310.0050.00318.35
8.1.300.0000.01516.11
8.1.290.0060.00330.84
8.1.280.0150.00025.92
8.1.270.0030.00622.00
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0000.01018.90
8.1.230.0060.00618.59
8.1.30.0290.00417.66

preferences:
35.76 ms | 403 KiB | 5 Q