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 = array_reduce( array_reverse(str_split($refBase)), function($result, $v) { static $i; $i ??= 0; return $result + ($v * WEIGHTS[$i++ % WEIGHTS_COUNT]); }, 0 ); 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.0120.01119.76
8.4.150.0070.00716.92
8.4.140.0090.01117.84
8.4.130.0100.00917.72
8.4.120.0110.00824.40
8.4.110.0120.00919.04
8.4.100.0030.00717.89
8.4.90.0130.00817.81
8.4.80.0100.00917.85
8.4.70.0030.00617.72
8.4.60.0100.00717.84
8.4.50.0090.01220.52
8.4.40.0030.00617.58
8.4.30.0190.00020.48
8.4.20.0110.00418.90
8.4.10.0060.00619.48
8.3.280.0090.00316.20
8.3.270.0120.01016.60
8.3.260.0100.01016.77
8.3.250.0070.00516.82
8.3.240.0110.00517.19
8.3.230.0130.00516.68
8.3.220.0080.01016.50
8.3.210.0110.01016.65
8.3.200.0110.00916.92
8.3.190.0110.00816.61
8.3.180.0100.00916.43
8.3.170.0030.01418.88
8.3.160.0190.00018.34
8.3.150.0080.00019.15
8.3.140.0040.00418.94
8.3.130.0070.00718.24
8.3.120.0080.00018.93
8.3.110.0060.00320.94
8.3.100.0040.00724.06
8.3.90.0040.01126.77
8.3.80.0090.00018.35
8.3.70.0080.00818.30
8.3.60.0060.01616.88
8.3.50.0070.00716.72
8.3.40.0070.01020.58
8.3.30.0120.00321.95
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0110.00819.00
8.2.280.0110.00818.30
8.2.270.0180.00017.06
8.2.260.0090.00920.31
8.2.250.0040.00418.47
8.2.240.0060.00317.40
8.2.230.0060.00322.58
8.2.220.0040.01537.54
8.2.210.0040.00426.77
8.2.200.0090.00316.50
8.2.190.0160.00316.71
8.2.180.0150.00616.75
8.2.170.0090.00619.11
8.2.160.0080.00522.96
8.2.150.0040.00425.66
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0060.00319.61
8.2.110.0110.01120.47
8.2.100.0240.00619.00
8.2.90.0170.01718.89
8.2.80.0170.01018.72
8.2.70.0320.00318.73
8.2.60.0180.01818.86
8.2.50.0170.01718.84
8.2.40.0290.00618.64
8.2.30.0200.00318.82
8.2.20.0260.00318.77
8.2.10.0240.01019.34
8.2.00.0220.01119.16
8.1.330.0090.00922.00
8.1.320.0090.01016.34
8.1.310.0170.00018.30
8.1.300.0060.00317.83
8.1.290.0060.00330.84
8.1.280.0120.00925.92
8.1.270.0040.00423.99
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0110.00418.64
8.1.230.0110.00318.74
8.1.220.0240.01018.63
8.1.210.0210.00319.79
8.1.200.0280.00718.54
8.1.190.0130.00318.41
8.1.180.0170.00018.50
8.1.170.0190.00918.58
8.1.160.0230.00618.57
8.1.150.0190.00320.55
8.1.140.0240.01018.51
8.1.130.0230.01018.63
8.1.120.0160.00418.52
8.1.110.0160.00318.70
8.1.100.0220.00418.53
8.1.90.0180.00018.43
8.1.80.0120.00418.68
8.1.70.0150.00718.88
8.1.60.0340.00318.73
8.1.50.0210.00318.64
8.1.40.0160.00318.84
8.1.30.0110.00418.98
8.1.20.0230.01518.81
8.1.10.0130.01718.80
8.1.00.0100.01018.61
8.0.300.0320.00317.94
8.0.290.0230.00017.95
8.0.280.0050.00517.89
8.0.270.0190.01317.92
8.0.260.0230.00017.68
8.0.250.0180.00917.84
8.0.240.0330.00317.94
8.0.230.0140.00718.39
8.0.220.0180.01117.95
8.0.210.0190.01517.89
8.0.200.0350.00318.00
8.0.190.0300.00317.77
8.0.180.0170.02017.92
8.0.170.0270.00317.86
8.0.160.0220.01117.86
8.0.150.0240.01417.79
8.0.140.0290.00317.67
8.0.130.0210.00718.32
8.0.120.0270.01017.76
8.0.110.0290.00017.89
8.0.100.0270.00917.90
8.0.90.0210.00617.84
8.0.80.0190.00018.00
8.0.70.0300.00317.81
8.0.60.0380.00317.93
8.0.50.0300.01117.85
8.0.30.0230.00917.88
8.0.20.0290.01118.07
8.0.10.0340.00618.10

preferences:
111.28 ms | 403 KiB | 5 Q