3v4l.org

run code in 300+ PHP versions simultaneously
<?php $accountNumber = '3883b'; $strNewAcctNum = ''; $strCode1 = '-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; $strCode2 = 'TMGKRLMKFDPRSKVQXZBSKLKVWSXMSDLHQPFVP'; $iKeyLen = strlen($strCode2); //Step 1 - take the last 4 characters and the first 4 characters and pad with zeros //FAL 2008-05-02 for account numbers that are less than 4 characters, the below was returning as null as opposed to all N characters. //$strTempAcctNum = substr($accountNumber,-4); $strTempAcctNum = strrev(substr(strrev($accountNumber),0,4)); $strTempAcctNum .= substr($accountNumber,0,4); $strTempAcctNum = substr($strTempAcctNum.'00000000',0,8); $sumPos = 0; //now loop through each character and replace with a new character from the Code2 string for ($i = 0; $i < strlen($strTempAcctNum); $i++) { $strChar = substr($strTempAcctNum,$i,1); $pos = strpos($strCode1, $strChar); if ($pos === false) $pos= 0; $pos = ($pos + $i * 13 ) % $iKeyLen; $sumPos += $pos; $strNewChar = substr($strCode2,$pos,1); $strNewAcctNum.=$strNewChar ; } echo $strNewAcctNum. substr($strCode2, $sumPos % $iKeyLen,1); //VRSGFXGPG

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.3.60.0090.00616.63
8.3.50.0280.00321.96
8.3.40.0120.00918.79
8.3.30.0120.00319.27
8.3.20.0040.00420.00
8.3.10.0000.00823.49
8.3.00.0050.00320.94
8.2.180.0150.00616.38
8.2.170.0040.01122.96
8.2.160.0120.00320.38
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0030.00526.16
8.2.120.0080.00019.36
8.2.110.0090.00022.11
8.2.100.0090.00620.53
8.2.90.0000.00819.22
8.2.80.0000.00817.97
8.2.70.0050.00317.75
8.2.60.0040.00718.00
8.2.50.0000.00818.07
8.2.40.0000.01018.22
8.2.30.0000.00818.32
8.2.20.0080.00017.66
8.2.10.0050.00218.14
8.2.00.0080.00019.52
8.1.280.0070.01325.92
8.1.270.0030.00523.77
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0000.00822.18
8.1.230.0040.00819.11
8.1.220.0080.00017.77
8.1.210.0040.00418.77
8.1.200.0030.00617.23
8.1.190.0030.00517.25
8.1.180.0080.00018.10
8.1.170.0000.00818.57
8.1.160.0070.00021.81
8.1.150.0080.00018.57
8.1.140.0070.00017.48
8.1.130.0000.00717.71
8.1.120.0000.00717.41
8.1.110.0000.00817.38
8.1.100.0070.00017.38
8.1.90.0040.00417.36
8.1.80.0000.01017.27
8.1.70.0000.00717.33
8.1.60.0000.00717.51
8.1.50.0000.00917.54
8.1.40.0000.00817.36
8.1.30.0000.00817.59
8.1.20.0000.00817.61
8.1.10.0000.00717.56
8.1.00.0020.00517.34
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0070.00018.33
8.0.270.0070.00017.19
8.0.260.0040.00417.19
8.0.250.0040.00416.98
8.0.240.0030.00616.95
8.0.230.0070.00016.86
8.0.220.0000.00716.84
8.0.210.0030.00316.86
8.0.200.0070.00016.98
8.0.190.0030.00317.03
8.0.180.0070.00016.94
8.0.170.0030.00516.81
8.0.160.0030.00316.91
8.0.150.0040.00416.85
8.0.140.0060.00316.78
8.0.130.0030.00313.37
8.0.120.0080.00016.77
8.0.110.0000.00716.80
8.0.100.0000.00716.75
8.0.90.0040.00416.74
8.0.80.0060.01316.94
8.0.70.0040.00416.89
8.0.60.0000.00716.91
8.0.50.0040.00416.79
8.0.30.0090.01017.19
8.0.20.0120.01017.40
8.0.10.0040.00416.99
8.0.00.0080.00916.62
7.4.330.0000.00615.00
7.4.320.0030.00316.51
7.4.300.0060.00016.62
7.4.290.0000.00716.61
7.4.280.0070.00016.51
7.4.270.0030.00416.45
7.4.260.0030.00316.41
7.4.250.0050.00316.39
7.4.240.0040.00416.59
7.4.230.0080.00016.56
7.4.220.0200.00616.44
7.4.210.0060.01716.55
7.4.200.0040.00416.51
7.4.160.0110.01116.38
7.4.150.0090.00917.40
7.4.140.0070.01017.86
7.4.130.0100.00816.54
7.4.120.0140.00316.43
7.4.110.0120.00416.45
7.4.100.0150.00616.63
7.4.90.0100.00716.45
7.4.80.0100.01019.39
7.4.70.0070.01016.43
7.4.60.0060.01216.50
7.4.50.0030.00616.53
7.4.40.0120.00916.43
7.4.30.0040.01216.55
7.4.00.0050.01315.11
7.3.330.0000.00613.18
7.3.320.0050.00013.24
7.3.310.0000.00716.21
7.3.300.0070.00016.25
7.3.290.0090.00916.34
7.3.280.0050.01316.34
7.3.270.0110.01117.40
7.3.260.0120.00616.62
7.3.250.0080.01116.58
7.3.240.0090.01216.48
7.3.230.0110.00716.39
7.3.210.0100.01016.57
7.3.200.0100.00719.39
7.3.190.0090.00916.24
7.3.180.0060.00916.54
7.3.170.0040.01816.54
7.3.160.0060.00916.63
7.3.120.0050.01214.88
7.3.110.0050.00814.89
7.3.100.0040.01115.00
7.3.90.0080.00315.00
7.3.80.0020.01414.82
7.3.70.0100.00314.76
7.3.60.0050.01014.93
7.3.50.0060.00814.73
7.3.40.0050.01114.70
7.3.30.0040.00914.86
7.3.20.0050.00616.83
7.3.10.0080.00616.56
7.3.00.0080.00616.61
7.2.330.0030.01716.42
7.2.320.0130.00316.44
7.2.310.0080.00816.47
7.2.300.0130.00316.59
7.2.290.0160.00016.74
7.2.250.0040.01515.02
7.2.240.0050.01015.00
7.2.230.0140.00215.13
7.2.220.0050.01215.06
7.2.210.0100.00715.00
7.2.200.0000.01315.07
7.2.190.0070.00614.99
7.2.180.0030.01114.94
7.2.170.0060.00814.96
7.2.160.0070.00715.19
7.2.150.0130.00316.69
7.2.140.0070.00416.77
7.2.130.0060.00616.83
7.2.120.0130.00716.85
7.2.110.0050.01016.79
7.2.100.0090.00516.90
7.2.90.0030.01316.69
7.2.80.0060.00716.75
7.2.70.0020.01416.69
7.2.60.0080.00516.72
7.2.50.0030.01216.98
7.2.40.0110.00316.97
7.2.30.0090.00716.91
7.2.20.0110.00816.94
7.2.10.0130.00516.74
7.2.00.0080.00817.72
7.1.330.0080.00515.91
7.1.320.0050.00715.79
7.1.310.0060.00915.74
7.1.300.0040.00815.82
7.1.290.0050.01015.82
7.1.280.0060.00415.94
7.1.270.0050.01115.89
7.1.260.0100.00415.69
7.1.250.0060.00915.80
7.1.200.0060.00615.83
7.1.100.0040.00818.07
7.1.70.0080.00017.22
7.1.60.0110.00319.70
7.1.50.0120.01216.85
7.1.00.0070.07322.36
7.0.200.0000.00716.32
7.0.140.0070.06722.08
7.0.60.0100.05720.08
7.0.50.0100.08317.91
7.0.40.0030.08720.23
7.0.30.0300.08020.17
7.0.20.0330.08020.00
7.0.10.0030.08020.13
7.0.00.0100.04720.16
5.6.280.0100.08320.79
5.6.210.0030.06720.53
5.6.200.0030.07318.23
5.6.190.0070.05320.41
5.6.180.2070.04020.27
5.6.170.0230.07720.54
5.6.160.0070.06020.49
5.6.150.0070.08318.09
5.6.140.0070.08318.12
5.6.130.0030.04318.18
5.6.120.0000.05021.01
5.6.110.0000.04320.99
5.6.100.0100.06321.01
5.6.90.0070.05021.00
5.6.80.0170.03720.36
5.6.70.4330.03720.37
5.5.350.0030.06720.39
5.5.340.0000.07317.96
5.5.330.0100.08720.43
5.5.320.0300.07320.24
5.5.310.0200.04720.28
5.5.300.0130.07318.01
5.5.290.0070.06718.01
5.5.280.0070.05020.77
5.5.270.0200.07320.88
5.5.260.0170.08020.80
5.5.250.0100.06320.61
5.5.240.0230.06320.36
5.4.450.0230.05331.27
5.4.440.0400.05329.33
5.4.430.0570.04729.29
5.4.420.0300.04729.29
5.4.410.0330.03729.27
5.4.400.0600.03028.69
5.4.390.0530.03326.63
5.4.380.0230.07018.68
5.4.370.0230.04318.53
5.4.360.0170.07018.59
5.4.350.0170.05318.61
5.4.340.0100.05318.50
5.4.320.0030.04012.46
5.4.310.0060.04312.46
5.4.300.0130.02912.46
5.4.290.0130.03112.46
5.4.280.0060.03512.36
5.4.270.0060.03712.36
5.4.260.0170.02712.36
5.4.250.0110.03212.36
5.4.240.0110.03112.36
5.4.230.0050.03812.35
5.4.220.0080.03412.35
5.4.210.0040.03712.35
5.4.200.0050.03812.35
5.4.190.0050.03712.35
5.4.180.0060.03612.34
5.4.170.0060.03612.36
5.4.160.0060.03612.35
5.4.150.0070.04212.35
5.4.140.0070.05012.04
5.4.130.0130.04012.02
5.4.120.0100.03711.98
5.4.110.0050.03611.98
5.4.100.0060.03611.97
5.4.90.0030.04011.97
5.4.80.0040.03811.97
5.4.70.0080.03211.97
5.4.60.0060.03511.97
5.4.50.0040.03711.97
5.4.40.0070.03311.96
5.4.30.0050.03711.96
5.4.20.0040.03711.95
5.4.10.0050.03711.95
5.4.00.0050.03611.45
5.3.290.0100.03512.80
5.3.280.0070.03712.71
5.3.270.0060.03912.73
5.3.260.0060.03912.72
5.3.250.0080.03512.72
5.3.240.0080.03512.72
5.3.230.0070.03712.71
5.3.220.0080.03612.68
5.3.210.0050.04212.68
5.3.200.0070.03512.68
5.3.190.0030.04012.68
5.3.180.0060.03612.68
5.3.170.0080.03512.67
5.3.160.0050.03712.67
5.3.150.0120.03112.68
5.3.140.0060.03612.66
5.3.130.0060.03812.66
5.3.120.0040.04012.66
5.3.110.0050.04012.66
5.3.100.0030.04112.11
5.3.90.0080.03512.08
5.3.80.0060.03712.08
5.3.70.0070.03612.07
5.3.60.0060.03612.06
5.3.50.0060.03712.00
5.3.40.0080.03512.00
5.3.30.0100.03411.95
5.3.20.0040.03911.73
5.3.10.0080.03311.70
5.3.00.0070.03511.69
5.2.170.0050.0339.19
5.2.160.0040.0319.19
5.2.150.0020.0359.20
5.2.140.0080.0269.19
5.2.130.0030.0319.15
5.2.120.0050.0289.15
5.2.110.0050.0329.16
5.2.100.0080.0269.15
5.2.90.0050.0329.15
5.2.80.0020.0339.14
5.2.70.0060.0319.15
5.2.60.0080.0369.10
5.2.50.0040.0379.07
5.2.40.0050.0299.05
5.2.30.0040.0319.02
5.2.20.0050.0329.01
5.2.10.0030.0328.93
5.2.00.0050.0308.79
5.1.60.0050.0238.08
5.1.50.0040.0268.07
5.1.40.0080.0228.05
5.1.30.0040.0338.40
5.1.20.0060.0338.43
5.1.10.0050.0248.15
5.1.00.0040.0298.16
5.0.50.0010.0266.64
5.0.40.0040.0206.50
5.0.30.0020.0326.31
5.0.20.0020.0226.28
5.0.10.0020.0256.25
5.0.00.0010.0346.25
4.4.90.0030.0164.78
4.4.80.0020.0174.75
4.4.70.0020.0164.75
4.4.60.0000.0184.75
4.4.50.0030.0154.77
4.4.40.0010.0274.71
4.4.30.0030.0154.76
4.4.20.0040.0144.84
4.4.10.0020.0164.85
4.4.00.0000.0274.76
4.3.110.0040.0144.66
4.3.100.0030.0144.67
4.3.90.0020.0154.64
4.3.80.0050.0224.58
4.3.70.0020.0154.63
4.3.60.0020.0154.63
4.3.50.0030.0154.62
4.3.40.0020.0244.54
4.3.30.0020.0153.30
4.3.20.0030.0153.28
4.3.10.0010.0163.23
4.3.00.0070.01725.65

preferences:
45.71 ms | 401 KiB | 5 Q