3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('WEIGHTS', [7, 3, 1]); define('WEIGHTS_COUNT', count(WEIGHTS)); $customerNumber = 1; $invoiceNumber = 25; $refBase = sprintf('%d%04d', $customerNumber, $invoiceNumber); $weightedSum = 0; for ($x = 0, $i = strlen($refBase) - 1; $i >=0; --$i, ++$x) { $weightedSum += $refBase[$i] * WEIGHTS[$x % WEIGHTS_COUNT]; } echo $refBase . (ceil($weightedSum / 10) * 10 - $weightedSum);

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.0160.00720.07
8.4.150.0020.00014.05
8.4.140.0120.00917.77
8.4.130.0100.01117.88
8.4.120.0050.00420.40
8.4.110.0130.00818.57
8.4.100.0140.00717.95
8.4.90.0070.00317.93
8.4.80.0060.00417.84
8.4.70.0090.00717.91
8.4.60.0030.00519.41
8.4.50.0100.00820.61
8.4.40.0090.00017.54
8.4.30.0100.01022.24
8.4.20.0070.01418.98
8.4.10.0000.00819.54
8.3.280.0140.00918.55
8.3.270.0130.00616.48
8.3.260.0090.01016.50
8.3.250.0090.01018.88
8.3.240.0130.00616.52
8.3.230.0100.01016.62
8.3.220.0090.00716.81
8.3.210.0120.00716.64
8.3.200.0110.00816.48
8.3.190.0140.00516.75
8.3.180.0090.01016.77
8.3.170.0120.00618.96
8.3.160.0130.00618.47
8.3.150.0070.00719.02
8.3.140.0110.00417.03
8.3.130.0190.00018.38
8.3.120.0160.00318.90
8.3.110.0040.00416.53
8.3.100.0130.00316.58
8.3.90.0000.00816.41
8.3.80.0090.00318.31
8.3.70.0110.00716.63
8.3.60.0200.00716.63
8.3.50.0120.00916.72
8.3.40.0030.01020.29
8.3.30.0090.00622.03
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0000.00826.16
8.2.290.0120.00718.76
8.2.280.0130.00416.50
8.2.270.0110.00717.01
8.2.260.0040.00416.76
8.2.250.0040.00418.24
8.2.240.0110.00718.34
8.2.230.0000.00920.94
8.2.220.0030.00724.06
8.2.210.0000.00826.77
8.2.200.0040.00716.75
8.2.190.0090.00618.41
8.2.180.0140.00718.61
8.2.170.0120.00319.04
8.2.160.0000.01322.96
8.2.150.0070.00025.66
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0100.01019.61
8.2.110.0070.00722.20
8.2.100.0220.00719.05
8.2.90.0220.01119.13
8.2.80.0120.00918.86
8.2.70.0140.00618.52
8.2.60.0170.00018.76
8.2.50.0130.00618.95
8.2.40.0110.00518.91
8.2.30.0030.00918.96
8.2.20.0070.01518.95
8.2.10.0190.00819.27
8.2.00.0170.00719.16
8.1.330.0110.00816.25
8.1.320.0080.01116.44
8.1.310.0090.00916.44
8.1.300.0060.00320.10
8.1.290.0040.00418.88
8.1.280.0140.00325.92
8.1.270.0110.00024.03
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0180.00418.60
8.1.230.0220.00018.74
8.1.220.0220.01518.70
8.1.210.0220.00719.71
8.1.200.0210.01418.61
8.1.190.0230.01018.29
8.1.180.0150.00318.50
8.1.170.0040.00818.61
8.1.160.0110.01918.91
8.1.150.0070.00720.57
8.1.140.0120.00418.51
8.1.130.0330.00018.58
8.1.120.0230.00718.61
8.1.110.0230.00018.57
8.1.100.0180.00018.55
8.1.90.0090.00618.58
8.1.80.0150.00018.68
8.1.70.0180.01118.78
8.1.60.0250.01018.78
8.1.50.0320.00418.49
8.1.40.0150.01218.94
8.1.30.0150.00718.82
8.1.20.0370.00318.83
8.1.10.0130.00318.75
8.1.00.0170.01018.88
8.0.300.0170.00317.95
8.0.290.0130.01017.67
8.0.280.0110.00017.99
8.0.270.0110.00517.93
8.0.260.0270.01017.79
8.0.250.0290.00617.95
8.0.240.0230.01517.96
8.0.230.0100.01018.25
8.0.220.0190.01218.00
8.0.210.0240.00717.95
8.0.200.0270.00318.07
8.0.190.0170.00717.96
8.0.180.0170.00017.96
8.0.170.0150.01517.88
8.0.160.0250.00617.68
8.0.150.0230.00717.84
8.0.140.0100.00717.87
8.0.130.0240.00618.38
8.0.120.0260.01317.73
8.0.110.0250.00417.98
8.0.100.0390.00317.84
8.0.90.0260.00718.01
8.0.80.0370.00417.63
8.0.70.0320.00617.83
8.0.60.0220.01517.77
8.0.50.0290.00617.93
8.0.30.0200.01017.95
8.0.20.0240.00718.00
8.0.10.0130.00518.03

preferences:
33.63 ms | 403 KiB | 5 Q