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);

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.0100.01018.56
8.3.50.0130.00722.11
8.3.40.0070.01418.57
8.3.30.0070.00719.09
8.3.20.0000.00720.21
8.3.10.0000.00823.65
8.3.00.0050.00320.80
8.2.180.0160.00616.50
8.2.170.0070.00722.96
8.2.160.0110.00420.39
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0060.01226.16
8.2.120.0050.00319.36
8.2.110.0080.00022.13
8.2.100.0060.00617.84
8.2.90.0000.00919.23
8.2.80.0030.00517.97
8.2.70.0000.00817.50
8.2.60.0030.00518.04
8.2.50.0060.00318.07
8.2.40.0040.00419.94
8.2.30.0000.00718.26
8.2.20.0030.00517.88
8.2.10.0040.00418.10
8.2.00.0040.00419.59
8.1.280.0140.00725.92
8.1.270.0040.00423.84
8.1.260.0070.00026.35
8.1.250.0000.00728.09
8.1.240.0080.00023.96
8.1.230.0040.00719.17
8.1.220.0040.00417.76
8.1.210.0030.00518.77
8.1.200.0070.00317.23
8.1.190.0090.00017.22
8.1.180.0040.00418.10
8.1.170.0070.00418.51
8.1.160.0080.00021.90
8.1.150.0090.00018.45
8.1.140.0000.00717.46
8.1.130.0000.00717.74
8.1.120.0000.00717.42
8.1.110.0030.00517.40
8.1.100.0040.00417.41
8.1.90.0000.00817.40
8.1.80.0030.00517.43
8.1.70.0000.00717.38
8.1.60.0060.00317.54
8.1.50.0060.00317.47
8.1.40.0070.00017.48
8.1.30.0000.00817.51
8.1.20.0000.00717.66
8.1.10.0040.00417.52
8.1.00.0040.00417.43
8.0.300.0020.00518.77
8.0.290.0000.00716.75
8.0.280.0070.00018.49
8.0.270.0050.00317.31
8.0.260.0030.00317.14
8.0.250.0040.00416.98
8.0.240.0000.00716.96
8.0.230.0030.00317.01
8.0.220.0000.00616.79
8.0.210.0070.00016.82
8.0.200.0030.00317.03
8.0.190.0000.00716.88
8.0.180.0080.00016.98
8.0.170.0000.00816.95
8.0.160.0040.00416.90
8.0.150.0000.00716.92
8.0.140.0000.00816.91
8.0.130.0030.00313.31
8.0.120.0040.00416.84
8.0.110.0070.00016.79
8.0.100.0040.00416.79
8.0.90.0050.00216.74
8.0.80.0060.00916.85
8.0.70.0080.00016.95
8.0.60.0020.00516.71
8.0.50.0040.00416.86
8.0.30.0150.00316.94
8.0.20.0120.01717.40
8.0.10.0060.00317.04
8.0.00.0130.00716.80
7.4.330.0000.00615.00
7.4.320.0030.00316.51
7.4.300.0030.00316.44
7.4.290.0030.00316.54
7.4.280.0000.00716.52
7.4.270.0030.00316.57
7.4.260.0030.00316.46
7.4.250.0040.00416.59
7.4.240.0040.00416.50
7.4.230.0000.00816.72
7.4.220.0100.01016.59
7.4.210.0060.00916.59
7.4.200.0040.00416.71
7.4.160.0000.01616.60
7.4.150.0110.00617.40
7.4.140.0080.00917.86
7.4.130.0080.01016.50
7.4.120.0090.00916.51
7.4.110.0100.01316.52
7.4.100.0130.00416.37
7.4.90.0130.00316.52
7.4.80.0090.01219.39
7.4.70.0100.00716.51
7.4.60.0090.00916.71
7.4.50.0040.00416.54
7.4.40.0070.01016.38
7.4.30.0100.00716.44
7.4.10.0040.01415.06
7.4.00.0050.01015.10
7.3.330.0000.00613.18
7.3.320.0050.00013.27
7.3.310.0060.00016.47
7.3.300.0050.00216.45
7.3.290.0040.01116.46
7.3.280.0080.00916.32
7.3.270.0140.00617.40
7.3.260.0080.01616.30
7.3.250.0160.00616.42
7.3.240.0060.01616.43
7.3.230.0130.00316.39
7.3.210.0070.01416.47
7.3.200.0130.00316.38
7.3.190.0140.00616.59
7.3.180.0070.00916.42
7.3.170.0060.00916.67
7.3.160.0060.01116.36
7.3.130.0100.00714.60
7.3.120.0090.00514.89
7.3.110.0090.00914.91
7.3.100.0020.01114.79
7.3.90.0080.00314.96
7.3.80.0040.00814.71
7.3.70.0020.01114.98
7.3.60.0060.00614.93
7.3.50.0070.00514.81
7.3.40.0050.00614.86
7.3.30.0020.01314.87
7.3.20.0060.00916.55
7.3.10.0040.00716.60
7.3.00.0050.00716.83
7.2.330.0070.01116.64
7.2.320.0030.01316.60
7.2.310.0110.00616.53
7.2.300.0080.00816.50
7.2.290.0030.01216.54
7.2.260.0140.00415.26
7.2.250.0090.00914.70
7.2.240.0040.01315.09
7.2.230.0060.00815.08
7.2.220.0040.00815.09
7.2.210.0050.00814.87
7.2.200.0080.00515.06
7.2.190.0070.00815.18
7.2.180.0020.00715.04
7.2.170.0050.01114.96
7.2.160.0040.00715.20
7.2.150.0000.01416.68
7.2.140.0070.00816.87
7.2.130.0080.00816.82
7.2.120.0030.00816.81
7.2.110.0070.00616.83
7.2.100.0070.00716.98
7.2.90.0050.00516.99
7.2.80.0020.01216.85
7.2.70.0070.00516.76
7.2.60.0050.01016.77
7.2.50.0090.00516.76
7.2.40.0080.00717.07
7.2.30.0070.00716.97
7.2.20.0030.00716.98
7.2.10.0100.00516.99
7.2.00.0080.00717.63
7.1.330.0060.00615.69
7.1.320.0050.00515.83
7.1.310.0060.00615.70
7.1.300.0080.00615.77
7.1.290.0040.00515.86
7.1.280.0030.00815.84
7.1.270.0080.00615.67
7.1.260.0040.00715.85
7.1.250.0050.00915.77
7.1.240.0110.00415.55
7.1.230.0000.01415.98
7.1.220.0080.00415.77
7.1.210.0060.00315.72
7.1.200.0130.00015.58
7.1.190.0030.00715.72
7.1.180.0040.00815.96
7.1.170.0040.00815.62
7.1.160.0000.01315.95
7.1.150.0070.01015.51
7.1.140.0030.00615.63
7.1.130.0000.01415.86
7.1.120.0070.01015.57
7.1.110.0030.01315.60
7.1.100.0080.00516.91
7.1.90.0030.00515.74
7.1.80.0100.00315.97
7.1.70.0040.01116.32
7.1.60.0060.01117.74
7.1.50.0140.01225.10
7.1.40.0040.00715.69
7.1.30.0030.01315.74
7.1.20.0040.01115.76
7.1.10.0030.00915.84
7.1.00.0060.04019.11
7.0.330.0060.00915.40
7.0.320.0040.01115.32
7.0.310.0070.00715.57
7.0.300.0060.00615.34
7.0.290.0070.00715.42
7.0.280.0080.00015.53
7.0.270.0050.00515.30
7.0.260.0030.01315.39
7.0.250.0090.00615.43
7.0.240.0080.00415.31
7.0.230.0080.00415.24
7.0.220.0030.01015.59
7.0.210.0060.00315.45
7.0.200.0050.00716.07
7.0.190.0000.01415.46
7.0.180.0040.00815.68
7.0.170.0060.00615.30
7.0.160.0040.01115.45
7.0.150.0060.00915.29
7.0.140.0000.04218.85
7.0.130.0000.01215.20
7.0.120.0000.01415.73
7.0.110.0090.00015.26
7.0.100.0090.00615.59
7.0.90.0070.00415.53
7.0.80.0000.01315.57
7.0.70.0060.00615.69
7.0.60.0090.04217.59
7.0.50.0120.03816.63
7.0.40.0040.02916.79
7.0.30.0280.03316.71
7.0.20.0170.03016.95
7.0.10.0180.04216.79
7.0.00.0060.02616.76
5.6.400.0000.01314.53
5.6.390.0030.01014.44
5.6.380.0000.01414.47
5.6.370.0060.01013.92
5.6.360.0100.00614.21
5.6.350.0000.01514.21
5.6.340.0000.00914.16
5.6.330.0040.01114.68
5.6.320.0100.00314.52
5.6.310.0000.01214.41
5.6.300.0060.00814.52
5.6.290.0060.00614.38
5.6.280.0050.04017.61
5.6.270.0030.00914.32
5.6.260.0030.01314.33
5.6.250.0030.00614.28
5.6.240.0070.00314.23
5.6.230.0000.01314.63
5.6.220.0060.00314.44
5.6.210.0080.03117.48
5.6.200.0080.02116.38
5.6.190.0180.03717.41
5.6.180.0250.03317.41
5.6.170.0120.02517.46
5.6.160.0050.02817.36
5.6.150.0090.03516.26
5.6.140.0030.02516.10
5.6.130.0070.03016.28
5.6.120.0050.04417.57
5.6.110.0110.02017.72
5.6.100.0140.03717.65
5.6.90.0080.04017.81
5.6.80.0030.03917.33
5.6.70.0070.02517.47
5.6.60.0120.00414.56
5.6.50.0100.00314.47
5.6.40.0090.00014.08
5.6.30.0070.00414.55
5.6.20.0070.00714.48
5.6.10.0070.00614.15
5.6.00.0070.00714.42
5.5.380.0000.01314.15
5.5.370.0070.00414.19
5.5.360.0030.01014.52
5.5.350.0130.04317.38
5.5.340.0030.04516.08
5.5.330.0040.02417.34
5.5.320.0070.02717.38
5.5.310.0170.04217.37
5.5.300.0020.02516.16
5.5.290.0030.04216.13
5.5.280.0110.03517.69
5.5.270.0080.04217.88
5.5.260.0070.04117.68
5.5.250.0150.03517.46
5.5.240.0060.03317.27
5.5.230.0090.00614.29
5.5.220.0040.00714.05
5.5.210.0070.01014.11
5.5.200.0000.00914.55
5.5.190.0060.00614.45
5.5.180.0090.00614.09
5.5.170.0000.01514.22
5.5.160.0060.00614.26
5.5.150.0000.00914.44
5.5.140.0050.00514.15
5.5.130.0060.01014.15
5.5.120.0120.00613.97
5.5.110.0070.00314.48
5.5.100.0100.00614.51
5.5.90.0120.00013.93
5.5.80.0070.00714.48
5.5.70.0060.00614.11
5.5.60.0030.00814.20
5.5.50.0030.01014.02
5.5.40.0040.01114.09
5.5.30.0070.00714.04
5.5.20.0030.00614.33
5.5.10.0100.00313.97
5.5.00.0080.00014.18
5.4.450.0300.03015.19
5.4.440.0390.03415.17
5.4.430.0050.03015.47
5.4.420.0350.00315.27
5.4.410.0030.03514.96
5.4.400.0110.03014.90
5.4.390.0080.03514.99
5.4.380.0200.02614.69
5.4.370.0080.02314.96
5.4.360.0040.02714.72
5.4.350.0070.01811.44
5.4.340.0060.03011.46
5.4.330.0030.00710.92
5.4.320.0070.02111.87
5.4.310.0040.02711.72
5.4.300.0070.01911.63
5.4.290.0080.02611.69
5.4.280.0070.02011.58
5.4.270.0060.02811.80
5.4.260.0070.02711.63
5.4.250.0080.02611.57
5.4.240.0070.03311.83
5.4.230.0070.03111.51
5.4.220.0050.03211.63
5.4.210.0100.03411.55
5.4.200.0090.03711.80
5.4.190.0040.02911.67
5.4.180.0040.02411.66
5.4.170.0070.02111.50
5.4.160.0080.01911.54
5.4.150.0100.02111.64
5.4.140.0070.02011.49
5.4.130.0040.02311.41
5.4.120.0080.01811.52
5.4.110.0080.02811.66
5.4.100.0040.02311.48
5.4.90.0070.02011.65
5.4.80.0020.02511.44
5.4.70.0030.02311.50
5.4.60.0060.01911.37
5.4.50.0070.02011.38
5.4.40.0040.02011.50
5.4.30.0070.01711.46
5.4.20.0050.02511.38
5.4.10.0040.02011.35
5.4.00.0040.02511.32
5.3.290.0040.02611.69
5.3.280.0060.02111.58
5.3.270.0040.02711.70
5.3.260.0060.03211.66
5.3.250.0040.03211.66
5.3.240.0050.03111.58
5.3.230.0050.02911.60
5.3.220.0040.02911.53
5.3.210.0080.01911.58
5.3.200.0070.02811.53
5.3.190.0050.02311.57
5.3.180.0040.03811.62
5.3.170.0050.04111.68
5.3.160.0090.03411.63
5.3.150.0060.03511.64
5.3.140.0070.01911.58
5.3.130.0030.02511.52
5.3.120.0040.02511.58
5.3.110.0040.02411.60
5.3.100.0040.02311.36
5.3.90.0090.01711.29
5.3.80.0040.02311.28
5.3.70.0080.02011.24
5.3.60.0080.02111.27
5.3.50.0070.02811.16
5.3.40.0030.02411.18
5.3.30.0040.02211.18
5.3.20.0080.01811.06
5.3.10.0060.03410.93
5.3.00.0040.03110.93
5.2.170.0060.0459.19
5.2.160.0040.0469.19
5.2.150.0060.0439.19
5.2.140.0060.0419.19
5.2.130.0060.0419.15
5.2.120.0090.0379.15
5.2.110.0080.0379.15
5.2.100.0090.0379.15
5.2.90.0070.0409.15
5.2.80.0060.0419.14
5.2.70.0040.0439.14
5.2.60.0050.0439.11
5.2.50.0050.0339.07
5.2.40.0080.0289.05
5.2.30.0070.0309.02
5.2.20.0050.0439.01
5.2.10.0060.0298.93
5.2.00.0030.0328.79
5.1.60.0060.0258.08
5.1.50.0020.0288.07
5.1.40.0030.0278.05
5.1.30.0050.0268.41
5.1.20.0030.0298.43
5.1.10.0030.0288.16
5.1.00.0060.0248.15
5.0.50.0050.0206.64
5.0.40.0030.0216.49
5.0.30.0060.0466.31
5.0.20.0050.0266.27
5.0.10.0040.0226.25
5.0.00.0050.0396.25
4.4.90.0050.0204.78
4.4.80.0050.0144.75
4.4.70.0010.0184.75
4.4.60.0040.0164.75
4.4.50.0030.0164.77
4.4.40.0020.0274.71
4.4.30.0030.0164.76
4.4.20.0030.0174.84
4.4.10.0040.0164.85
4.4.00.0050.0314.76
4.3.110.0020.0184.67
4.3.100.0030.0234.67
4.3.90.0020.0174.63
4.3.80.0050.0314.59
4.3.70.0000.0204.63
4.3.60.0010.0174.63
4.3.50.0040.0224.63
4.3.40.0040.0324.54
4.3.30.0070.0173.30
4.3.20.0040.0163.27
4.3.10.0010.0223.23
4.3.00.0000.0236.55

preferences:
36.31 ms | 401 KiB | 5 Q