3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('WEIGHTS', [7, 3, 1]); define('WEIGHTS_COUNT', count(WEIGHTS)); $customerNumber = 1; $invoiceNumber = 25; echo ($refBase = sprintf('%d%04d', $customerNumber, $invoiceNumber)) . $verificationDigit = ( fn($weightedSum) => (ceil($weightedSum / 10) * 10 - $weightedSum) )(array_reduce( str_split(strrev($refBase)), function($result, $v) { static $i; $i ??= 0; return $result + ($v * WEIGHTS[$i++ % WEIGHTS_COUNT]); }, 0 ) );

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.10.0080.01016.73
8.5.00.0140.00720.04
8.4.150.0020.00014.05
8.4.140.0120.01017.53
8.4.130.0120.01017.57
8.4.120.0120.00922.24
8.4.110.0060.00420.80
8.4.100.0120.00618.00
8.4.90.0030.00520.56
8.4.80.0140.00518.84
8.4.70.0060.00519.13
8.4.60.0150.00618.84
8.4.50.0120.00819.50
8.4.40.0040.00417.80
8.4.30.0130.00322.36
8.4.20.0060.01318.77
8.4.10.0030.00719.61
8.3.280.0130.00818.43
8.3.270.0140.00916.47
8.3.260.0120.00916.84
8.3.250.0120.00818.83
8.3.240.0080.01216.62
8.3.230.0110.01016.42
8.3.220.0030.00518.95
8.3.210.0080.00916.60
8.3.200.0060.00316.67
8.3.190.0050.00216.74
8.3.180.0120.01016.94
8.3.170.0040.01519.05
8.3.160.0060.01218.27
8.3.150.0130.00720.86
8.3.140.0050.00317.14
8.3.130.0120.00318.48
8.3.120.0130.00318.82
8.3.110.0070.00720.94
8.3.100.0090.00024.06
8.3.90.0050.00326.77
8.3.80.0060.00318.30
8.3.70.0090.00616.50
8.3.60.0040.01116.61
8.3.50.0150.00318.66
8.3.40.0070.00720.42
8.3.30.0140.00021.93
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0040.00426.16
8.2.290.0120.00318.73
8.2.280.0040.00518.20
8.2.270.0140.00417.43
8.2.260.0100.01016.72
8.2.250.0040.00822.40
8.2.240.0090.00918.80
8.2.230.0040.00422.58
8.2.220.0100.01037.54
8.2.210.0090.00926.77
8.2.200.0030.00618.54
8.2.190.0120.00316.63
8.2.180.0060.00916.50
8.2.170.0120.00318.96
8.2.160.0090.00922.96
8.2.150.0000.00725.66
8.2.140.0050.00524.66
8.2.130.0040.00426.16
8.2.120.0030.00619.79
8.2.110.0050.01620.48
8.2.100.0200.01119.07
8.2.90.0250.00918.92
8.2.80.0170.00618.83
8.2.70.0240.00318.83
8.2.60.0310.00618.64
8.2.50.0180.00518.70
8.2.40.0230.00518.82
8.2.30.0050.00718.85
8.2.20.0160.00318.70
8.2.10.0150.00819.10
8.2.00.0270.00619.25
8.1.330.0090.01017.78
8.1.320.0130.00917.78
8.1.310.0080.00020.22
8.1.300.0060.00320.19
8.1.290.0040.00430.84
8.1.280.0040.01125.92
8.1.270.0070.00023.99
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0200.01218.59
8.1.230.0150.00818.72
8.1.220.0290.00618.57
8.1.210.0260.00719.94
8.1.200.0190.01018.51
8.1.190.0240.00818.50
8.1.180.0270.00518.53
8.1.170.0130.00518.50
8.1.160.0180.00518.71
8.1.150.0090.00720.61
8.1.140.0240.00418.54
8.1.130.0200.00518.47
8.1.120.0170.01218.67
8.1.110.0180.00418.48
8.1.100.0240.01418.52
8.1.90.0200.01018.45
8.1.80.0100.01518.57
8.1.70.0150.00718.73
8.1.60.0270.00318.77
8.1.50.0370.00318.64
8.1.40.0230.00718.92
8.1.30.0120.01119.06
8.1.20.0280.00318.85
8.1.10.0180.00718.68
8.1.00.0210.00618.80
8.0.300.0250.01017.86
8.0.290.0180.00517.78
8.0.280.0170.00317.82
8.0.270.0260.00817.88
8.0.260.0190.00717.74
8.0.250.0280.00817.98
8.0.240.0210.00618.02
8.0.230.0090.01219.36
8.0.220.0090.01217.95
8.0.210.0210.00517.84
8.0.200.0220.01018.04
8.0.190.0280.00917.89
8.0.180.0300.01117.85
8.0.170.0230.00717.93
8.0.160.0280.00817.93
8.0.150.0270.01017.86
8.0.140.0190.01217.85
8.0.130.0280.00318.19
8.0.120.0230.00717.80
8.0.110.0200.00717.93
8.0.100.0240.00617.79
8.0.90.0130.01017.78
8.0.80.0260.00517.78
8.0.70.0140.01217.88
8.0.60.0220.01217.75
8.0.50.0320.00317.96
8.0.30.0240.00717.95
8.0.20.0290.00717.88
8.0.10.0290.00918.11

preferences:
44.7 ms | 403 KiB | 5 Q