3v4l.org

run code in 300+ PHP versions simultaneously
<?php $members = array( array( 'num' => 2, 'rank' => 0, 'dense_rank' => 0, ), array( 'num' => 2, 'rank' => 0, 'dense_rank' => 0, ), array( 'num' => 3, 'rank' => 0, 'dense_rank' => 0, ), array( 'num' => 3, 'rank' => 0, 'dense_rank' => 0, ), array( 'num' => 3, 'rank' => 0, 'dense_rank' => 0, ), array( 'num' => 3, 'rank' => 0, 'dense_rank' => 0, ), array( 'num' => 3, 'rank' => 0, 'dense_rank' => 0, ), array( 'num' => 5, 'rank' => 0, 'dense_rank' => 0, ), array( 'num' => 9, 'rank' => 0, 'dense_rank' => 0, ), array( 'num' => 9, 'rank' => 0, 'dense_rank' => 0, ), array( 'num' => 9, 'rank' => 0, 'dense_rank' => 0, ) ); $denseRank = 0; $gappedRank = 0; foreach ($members as &$row) { $denseRanks[$row['num']] ??= ++$denseRank; $row['dense_rank'] = $denseRanks[$row['num']]; ++$gappedRank; $gappedRanks[$row['num']] ??= $gappedRank; $row['rank'] = $gappedRanks[$row['num']]; // for better presentation: echo json_encode($row) . "\n"; } //var_export($members);

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.00.0150.00620.11
8.4.150.0030.00014.05
8.4.140.0120.01617.56
8.4.130.0040.00517.88
8.4.120.0150.00620.94
8.4.110.0110.00922.61
8.4.100.0100.00917.79
8.4.90.0060.00618.77
8.4.80.0040.00420.45
8.4.70.0060.00217.80
8.4.60.0060.00619.18
8.4.50.0140.00724.18
8.4.40.0130.00617.75
8.4.30.0110.00818.25
8.4.20.0130.00620.26
8.4.10.0140.00721.93
8.3.280.0110.01020.03
8.3.270.0140.00716.63
8.3.260.0120.00816.64
8.3.250.0150.00318.93
8.3.240.0100.00916.50
8.3.230.0100.01016.41
8.3.220.0130.00518.92
8.3.210.0100.00616.54
8.3.200.0060.00316.72
8.3.190.0120.00716.50
8.3.180.0110.00816.22
8.3.170.0080.00016.66
8.3.160.0040.00418.34
8.3.150.0090.00919.08
8.3.140.0120.00316.59
8.3.130.0090.00018.45
8.3.120.0060.00320.89
8.3.110.0030.00516.64
8.3.100.0050.00516.61
8.3.90.0070.00326.77
8.3.80.0060.00316.75
8.3.70.0090.01218.55
8.3.60.0090.00616.63
8.3.50.0140.00019.98
8.3.40.0150.00018.87
8.3.30.0130.00318.79
8.3.20.0040.00424.18
8.3.10.0080.00024.66
8.3.00.0000.00826.16
8.2.290.0090.00120.51
8.2.280.0120.00718.64
8.2.270.0190.00017.00
8.2.260.0140.00319.32
8.2.250.0030.00516.82
8.2.240.0040.00418.92
8.2.230.0000.00820.94
8.2.220.0060.00924.06
8.2.210.0040.00426.77
8.2.200.0100.00016.63
8.2.190.0120.00916.58
8.2.180.0130.00325.92
8.2.170.0070.00722.96
8.2.160.0140.00022.96
8.2.150.0000.00725.66
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0060.00321.00
8.2.110.0060.00320.43
8.2.100.0110.00017.84
8.2.90.0040.00417.84
8.2.80.0000.00817.97
8.2.70.0000.00817.75
8.2.60.0040.00417.93
8.2.50.0060.00318.07
8.2.40.0060.00319.88
8.2.30.0040.00418.21
8.2.20.0040.00420.53
8.2.10.0040.00418.23
8.2.00.0050.01019.33
8.1.330.0100.00822.02
8.1.320.0100.00916.14
8.1.310.0050.00318.64
8.1.300.0090.00019.83
8.1.290.0090.00030.84
8.1.280.0070.00725.92
8.1.270.0050.00522.03
8.1.260.0180.00426.35
8.1.250.0030.00528.09
8.1.240.0130.00320.76
8.1.230.0080.00422.75
8.1.220.0030.00517.74
8.1.210.0030.00519.08
8.1.200.0060.00317.35
8.1.190.0050.00317.35
8.1.180.0050.00518.10
8.1.170.0040.00418.42
8.1.160.0050.00318.96
8.1.150.0020.00518.55
8.1.140.0000.00717.44
8.1.130.0040.00417.45
8.1.120.0040.00417.46
8.1.110.0000.00717.38
8.1.100.0040.00417.43
8.1.90.0030.00517.50
8.1.80.0030.00617.41
8.1.70.0050.00517.39
8.1.60.0110.00717.54
8.1.50.0110.00617.45
8.1.40.0100.00717.54
8.1.30.0110.00617.75
8.1.20.0100.00717.54
8.1.10.0110.00617.61
8.1.00.0170.00017.56
8.0.300.0040.00420.20
8.0.290.0040.00416.88
8.0.280.0000.00818.52
8.0.270.0040.00418.08
8.0.260.0030.00516.91
8.0.250.0030.00317.02
8.0.240.0040.00416.89
8.0.230.0030.00616.95
8.0.220.0060.00016.82
8.0.210.0000.00716.86
8.0.200.0090.00016.90
8.0.190.0110.00416.91
8.0.180.0080.00416.93
8.0.170.0040.00816.70
8.0.160.0120.00016.59
8.0.150.0090.00216.76
8.0.140.0100.00016.87
8.0.130.0060.00616.76
8.0.120.0050.01016.93
8.0.110.0000.01316.98
8.0.100.0110.00416.90
8.0.90.0130.00016.84
8.0.80.0000.01016.93
8.0.70.0050.00516.96
8.0.60.0090.00016.75
8.0.50.0020.00516.96
8.0.30.0050.00516.92
8.0.20.0140.00016.98
8.0.10.0110.00417.00
7.4.330.0030.00315.55
7.4.320.0000.00716.68
7.4.300.0130.00316.61
7.4.290.0140.00316.59
7.4.280.0080.00816.46
7.4.270.0090.00616.64
7.4.260.0120.00416.42
7.4.250.0140.00216.63
7.4.240.0100.00516.45
7.4.230.0100.00716.38
7.4.220.0110.00416.63
7.4.210.0100.00316.51
7.4.200.0100.00216.66
7.4.190.0050.00515.86
7.4.180.0100.00316.61
7.4.160.0070.00616.67
7.4.150.0130.00016.39
7.4.140.0040.00716.21
7.4.130.0040.00616.51
7.4.120.0070.00216.25
7.4.110.0080.00416.43
7.4.100.0080.00416.52
7.4.90.0080.00516.48
7.4.80.0100.00316.35
7.4.70.0060.00316.40
7.4.60.0040.00416.48
7.4.50.0040.00416.39
7.4.40.0070.00416.29
7.4.30.0110.00016.42
7.4.20.0070.00416.50
7.4.10.0030.00616.46
7.4.00.0150.00716.94
7.0.160.0090.00916.59
5.6.400.0160.00915.19
5.6.200.0160.00615.59

preferences:
140.34 ms | 403 KiB | 5 Q