3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<JSON { "mlb": { "james": { "avgTotalPoints": 80.675, "avgPointsDifferential": -0.8112500000000002, "rank": null }, "mary": { "avgTotalPoints": 114.9875, "avgPointsDifferential": 6.262500000000003, "rank": null }, "lucas": { "avgTotalPoints": 66.825, "avgPointsDifferential": -9.10625, "rank": null }, "timothy": { "avgTotalPoints": 69.2625, "avgPointsDifferential": -19.14125, "rank": null }, "samantha": { "avgTotalPoints": 91.625, "avgPointsDifferential": -36.85000000000001, "rank": null } }, "nhl": { "samantha": { "avgTotalPoints": 82.20000000000002, "avgPointsDifferential": 15.005714285714289, "rank": null }, "peter": { "avgTotalPoints": 77.65714285714284, "avgPointsDifferential": -13.31857142857143, "rank": null }, "rick": { "avgTotalPoints": 91.61428571428571, "avgPointsDifferential": 11.217142857142859, "rank": null }, "bubba": { "avgTotalPoints": 119.60000000000001, "avgPointsDifferential": 28.13333333333334, "rank": null }, "james": { "avgTotalPoints": 90.18571428571428, "avgPointsDifferential": 10.915714285714285, "rank": null } } } JSON; function sortHighestToLowest(array $arr): array { return array_map(static function (array $entries): array { uasort($entries, static function (array $entry1, array $entry2): int { return $entry2['avgTotalPoints'] <=> $entry1['avgTotalPoints']; }); $rank = 0; foreach ($entries as &$entry) { $entry['rank'] = ++$rank; } return $entries; }, $arr); } $arr = json_decode($json, true, 512, JSON_THROW_ON_ERROR); print_r(sortHighestToLowest($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.3.130.0080.00018.25
8.3.120.0060.00318.99
8.3.110.0030.00620.94
8.3.100.0030.00624.06
8.3.90.0050.00316.53
8.3.80.0060.00318.25
8.3.70.0130.01018.22
8.3.60.0120.00318.30
8.3.50.0080.01024.39
8.3.40.0180.00418.82
8.3.30.0120.00618.66
8.3.20.0080.00024.18
8.3.10.0000.01024.66
8.3.00.0050.00326.16
8.2.250.0030.00618.47
8.2.240.0100.01017.24
8.2.230.0030.00622.58
8.2.220.0060.00337.54
8.2.210.0110.00026.77
8.2.200.0100.00018.17
8.2.190.0030.01616.63
8.2.180.0100.00725.92
8.2.170.0160.00319.09
8.2.160.0100.00322.96
8.2.150.0080.00025.66
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0080.00026.35
8.2.110.0100.01322.16
8.2.100.0120.00017.91
8.2.90.0040.00417.75
8.2.80.0050.00518.78
8.2.70.0040.00417.50
8.2.60.0080.00017.63
8.2.50.0000.00818.05
8.2.40.0000.00819.95
8.2.30.0000.00818.22
8.2.20.0000.00718.26
8.2.10.0060.00319.22
8.2.00.0040.00419.29
8.1.300.0060.00318.09
8.1.290.0060.00318.88
8.1.280.0070.00725.92
8.1.270.0000.00823.99
8.1.260.0040.00428.09
8.1.250.0050.00328.09
8.1.240.0060.00321.06
8.1.230.0100.00017.77
8.1.220.0050.00317.79
8.1.210.0050.00318.77
8.1.200.0050.00317.35
8.1.190.0040.00417.35
8.1.180.0050.00318.10
8.1.170.0050.00318.63
8.1.160.0000.00818.82
8.1.150.0060.00318.96
8.1.140.0030.00518.95
8.1.130.0000.00717.53
8.1.120.0030.00617.50
8.1.110.0040.00417.50
8.1.100.0000.00717.55
8.1.90.0040.00417.31
8.1.80.0070.00317.34
8.1.70.0000.01117.49
8.1.60.0080.00017.64
8.1.50.0030.00717.52
8.1.40.0040.00417.52
8.1.30.0040.00417.51
8.1.20.0050.00317.69
8.1.10.0030.00617.52
8.1.00.0000.00817.59
8.0.300.0030.00618.77
8.0.290.0000.00816.88
8.0.280.0080.00018.48
8.0.270.0070.00018.13
8.0.260.0000.00716.93
8.0.250.0030.00316.90
8.0.240.0050.00316.93
8.0.230.0040.00417.12
8.0.220.0030.00316.98
8.0.210.0030.00317.01
8.0.200.0040.00417.04
8.0.190.0050.00317.03
8.0.180.0040.00417.02
8.0.170.0060.00317.05
8.0.160.0040.00417.04
8.0.150.0040.00416.89
8.0.140.0000.01016.97
8.0.130.0070.00013.41
8.0.120.0000.00716.90
8.0.110.0040.00416.86
8.0.100.0020.00516.82
8.0.90.0040.00416.80
8.0.80.0070.00916.97
8.0.70.0000.00716.90
8.0.60.0030.00517.05
8.0.50.0000.00816.85
8.0.30.0110.00617.31
8.0.20.0090.01017.16
8.0.10.0020.00517.00
8.0.00.0070.01116.79
7.4.330.0050.00016.84
7.4.320.0000.00616.54
7.4.300.0070.00016.53
7.4.290.0070.00016.60
7.4.280.0000.00816.63
7.4.270.0020.00516.65
7.4.260.0030.00313.25
7.4.250.0000.00716.58
7.4.240.0030.00316.69
7.4.230.0000.00716.74
7.4.220.0010.00616.60
7.4.210.0080.00816.58
7.4.200.0030.00316.63
7.4.130.0110.01116.43
7.4.120.0100.01016.48
7.4.110.0090.00916.73
7.4.100.0140.00316.68
7.4.90.0120.00616.72
7.4.80.0090.01216.66
7.4.70.0120.01216.53
7.4.60.0170.00316.62
7.4.50.0130.01016.76
7.4.40.0130.01016.47
7.4.30.0030.01416.62
7.4.20.0110.01216.59
7.4.10.0060.01316.79
7.4.00.0150.00316.43
7.3.330.0070.00016.48
7.3.320.0030.00313.36
7.3.310.0030.00316.53
7.3.300.0060.00016.52
7.3.290.0080.01016.49
7.3.260.0120.00916.69
7.3.230.0070.01016.45
7.3.210.0130.01016.46
7.3.200.0060.01216.44
7.3.190.0150.00316.70
7.3.180.0060.01216.46
7.3.170.0130.00316.55
7.3.160.0130.01016.60
7.3.150.0110.00916.59
7.3.140.0120.00616.52
7.3.130.0110.00716.58
7.3.120.0060.01216.55
7.3.110.0120.00616.40
7.3.100.0120.00616.55
7.3.90.0070.01116.47
7.3.80.0100.00716.33
7.3.70.0130.01016.34
7.3.60.0030.01516.48
7.3.50.0140.00416.51
7.3.40.0090.01216.56
7.3.30.0140.00716.50
7.3.20.0140.00416.39
7.3.10.0110.00816.62
7.3.00.0120.00816.50
7.2.330.0100.01016.64
7.2.320.0100.01316.77
7.2.310.0030.02016.49
7.2.300.0070.01416.57
7.2.290.0080.01616.69
7.2.280.0120.00616.48
7.2.270.0120.00916.54
7.2.260.0000.01816.73
7.2.250.0110.00716.77
7.2.240.0080.01116.73
7.2.230.0120.00616.57
7.2.220.0110.00716.47
7.2.210.0110.00816.57
7.2.200.0180.00016.61
7.2.190.0130.00616.53
7.2.180.0090.00916.48
7.2.170.0100.01316.70
7.2.160.0120.00616.58
7.2.150.0060.01916.61
7.2.140.0150.01016.66
7.2.130.0090.00916.65
7.2.120.0030.01716.61
7.2.110.0120.00816.58
7.2.100.0080.01216.68
7.2.90.0110.00816.75
7.2.80.0100.01016.46
7.2.70.0070.01116.56
7.2.60.0110.00716.58
7.2.50.0060.01216.55
7.2.40.0090.01016.54
7.2.30.0130.01216.57
7.2.20.0030.02216.62
7.2.10.0250.01316.46
7.2.00.0060.02016.45

preferences:
28.06 ms | 403 KiB | 5 Q