3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['A', 'A', 'B', 'B', 'C', 'A', 'A']; $result = []; foreach ($array as $v) { if (!isset($ref[$v])) { unset($ref); $ref[$v] = 1; $result[$v][] =& $ref[$v]; } else { ++$ref[$v]; } } var_export($result);

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.120.0050.00524.33
8.4.110.0110.00818.82
8.4.100.0060.00318.96
8.4.90.0060.00322.11
8.4.80.0100.01018.83
8.4.70.0100.01019.14
8.4.60.0120.01018.82
8.4.50.0040.00520.54
8.4.40.0130.00617.70
8.4.30.0080.01120.27
8.4.20.0200.00021.23
8.4.10.0030.00619.50
8.3.250.0110.00718.87
8.3.240.0140.00417.22
8.3.230.0110.00716.70
8.3.220.0090.01019.04
8.3.210.0060.00216.50
8.3.200.0060.00316.80
8.3.190.0060.00317.25
8.3.180.0110.01018.64
8.3.170.0060.00317.23
8.3.160.0070.01118.25
8.3.150.0030.00616.82
8.3.140.0090.00916.87
8.3.130.0280.01316.18
8.3.120.0310.00916.67
8.3.110.0310.01416.58
8.3.100.0390.00916.41
8.3.90.0430.00416.18
8.3.80.0390.00716.59
8.3.70.0430.00316.44
8.3.60.0340.01016.65
8.3.50.0230.02316.36
8.3.40.0310.00717.16
8.3.30.0290.01217.52
8.3.20.0380.00017.56
8.3.10.0270.00917.23
8.3.00.0060.01617.51
8.2.290.0040.00420.40
8.2.280.0030.00518.41
8.2.270.0100.01016.49
8.2.260.0000.00817.33
8.2.250.0260.01516.48
8.2.240.0370.00416.23
8.2.230.0290.00416.27
8.2.220.0280.00316.41
8.2.210.0320.00716.63
8.2.200.0330.00716.41
8.2.190.0360.00616.26
8.2.180.0170.00516.51
8.2.170.0210.00017.72
8.2.160.0130.00617.65
8.2.150.0150.00617.67
8.2.140.0240.00017.08
8.2.130.0160.00317.63
8.2.120.0160.00317.69
8.2.110.0160.00417.61
8.2.100.0180.00317.65
8.2.90.0130.00717.44
8.2.80.0150.00617.23
8.2.70.0180.00017.25
8.2.60.0130.00417.64
8.2.50.0180.00017.53
8.2.40.0170.00017.71
8.2.30.0150.00917.63
8.2.20.0240.00017.61
8.2.10.0100.01717.35
8.2.00.0260.00317.34
8.1.330.0120.00621.81
8.1.320.0120.00716.34
8.1.310.0040.01116.57
8.1.300.0260.00316.18
8.1.290.0170.00616.18
8.1.280.0290.00316.18
8.1.270.0290.01317.30
8.1.260.0320.01117.27
8.1.250.0280.01417.11
8.1.240.0270.01017.34
8.1.230.0220.01417.18
8.1.220.0270.01717.33
8.1.210.0230.01017.46
8.1.200.0260.00617.27
8.1.190.0430.00417.33
8.1.180.0290.01017.29
8.1.170.0240.00817.24
8.1.160.0200.01217.14
8.1.150.0270.00717.36
8.1.140.0380.00316.89
8.1.130.0250.00417.25
8.1.120.0190.00017.09
8.1.110.0180.00417.06
8.1.100.0200.00317.29
8.1.90.0110.00717.18
8.1.80.0100.01017.25
8.1.70.0160.00017.16
8.1.60.0110.00717.43
8.1.50.0090.00917.48
8.1.40.0220.00017.20
8.1.30.0180.00417.28
8.1.20.0170.00317.29
8.1.10.0180.00017.27
8.1.00.0240.00617.34

preferences:
28.02 ms | 403 KiB | 5 Q