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.0150.00318.30
8.3.50.0120.00522.11
8.3.40.0140.00318.64
8.3.30.0100.01019.13
8.3.20.0040.00420.34
8.3.10.0080.00023.70
8.3.00.0070.00020.77
8.2.180.0060.01216.32
8.2.170.0110.00422.96
8.2.160.0100.00320.52
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0000.00819.36
8.2.110.0030.00622.26
8.2.100.0090.00317.84
8.2.90.0060.00319.40
8.2.80.0050.00317.97
8.2.70.0090.00017.50
8.2.60.0080.00017.93
8.2.50.0060.00318.07
8.2.40.0080.00019.88
8.2.30.0000.00718.36
8.2.20.0040.00417.73
8.2.10.0070.00018.19
8.2.00.0040.00419.55
8.1.280.0150.00025.92
8.1.270.0060.00323.76
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0000.00924.03
8.1.230.0100.00319.18
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0040.00417.35
8.1.190.0000.00916.99
8.1.180.0040.00418.10
8.1.170.0110.00018.50
8.1.160.0040.00421.95
8.1.150.0000.00818.61
8.1.140.0040.00417.40
8.1.130.0030.00317.80
8.1.120.0000.00717.32
8.1.110.0060.00317.32
8.1.100.0040.00417.39
8.1.90.0030.00317.44
8.1.80.0040.00417.36
8.1.70.0030.00317.33
8.1.60.0030.00617.51
8.1.50.0000.00817.37
8.1.40.0050.00317.35
8.1.30.0030.00617.63
8.1.20.0050.00217.59
8.1.10.0030.00617.36
8.1.00.0040.00417.56
8.0.300.0030.00318.77
8.0.290.0000.00916.75
8.0.280.0030.00318.50
8.0.270.0040.00417.15
8.0.260.0000.00617.32
8.0.250.0000.00716.96
8.0.240.0000.00716.97
8.0.230.0070.00016.87
8.0.220.0030.00316.91
8.0.210.0060.00016.90
8.0.200.0000.00716.97
8.0.190.0030.00616.87
8.0.180.0030.00516.93
8.0.170.0040.00416.94
8.0.160.0070.00017.01
8.0.150.0040.00416.70
8.0.140.0040.00416.77
8.0.130.0070.00013.34
8.0.120.0090.00016.84
8.0.110.0030.00616.92
8.0.100.0040.00416.91
8.0.90.0000.00716.79
8.0.80.0070.01516.83
8.0.70.0040.00416.79
8.0.60.0070.00016.78
8.0.50.0080.00016.75
8.0.30.0070.01517.13
8.0.20.0110.00917.40
8.0.10.0000.00816.88
8.0.00.0100.00816.74
7.4.330.0020.00215.15
7.4.320.0030.00316.54
7.4.300.0000.00616.68
7.4.290.0000.00716.45
7.4.280.0030.00316.46
7.4.270.0040.00416.63
7.4.260.0000.00716.50
7.4.250.0030.00616.47
7.4.240.0050.00216.56
7.4.230.0080.00016.35
7.4.220.0100.00716.47
7.4.210.0110.00316.60
7.4.200.0070.00016.64
7.4.160.0090.00616.39
7.4.150.0090.00917.40
7.4.140.0100.01217.86
7.4.130.0130.00516.49
7.4.120.0100.00716.55
7.4.110.0130.01016.42
7.4.100.0090.00916.50
7.4.90.0080.00816.39
7.4.80.0070.01619.39
7.4.70.0110.00516.42
7.4.60.0030.01516.54
7.4.50.0020.00216.57
7.4.40.0030.01316.29
7.4.30.0130.00316.43
7.4.10.0100.01015.10
7.4.00.0060.01014.86
7.3.330.0000.00613.18
7.3.320.0030.00313.23
7.3.310.0060.00016.24
7.3.300.0070.00016.24
7.3.290.0060.00916.39
7.3.280.0090.01016.37
7.3.270.0070.01017.40
7.3.260.0040.01316.24
7.3.250.0120.00916.43
7.3.240.0090.01216.31
7.3.230.0060.00916.39
7.3.210.0070.01116.26
7.3.200.0130.00316.50
7.3.190.0180.00616.46
7.3.180.0110.00416.48
7.3.170.0100.01016.61
7.3.160.0000.01616.55
7.3.130.0110.00614.75
7.3.120.0100.00614.79
7.3.110.0050.01414.96
7.3.100.0100.00814.76
7.3.90.0100.00314.89
7.3.80.0050.00814.81
7.3.70.0060.00714.69
7.3.60.0060.00514.69
7.3.50.0090.00514.74
7.3.40.0060.00714.81
7.3.30.0040.00914.65
7.3.20.0090.00516.68
7.3.10.0080.00916.65
7.3.00.0060.00516.66
7.2.330.0040.01416.36
7.2.320.0110.00716.70
7.2.310.0090.00916.49
7.2.300.0130.00916.77
7.2.290.0070.00716.67
7.2.260.0040.01615.13
7.2.250.0070.01114.89
7.2.240.0080.00714.76
7.2.230.0060.00915.01
7.2.220.0050.01115.04
7.2.210.0090.00715.09
7.2.200.0040.00614.92
7.2.190.0090.00515.00
7.2.180.0030.01015.00
7.2.170.0020.01415.14
7.2.160.0050.00715.19
7.2.150.0040.00616.80
7.2.140.0050.01116.89
7.2.130.0020.01116.89
7.2.120.0100.00716.82
7.2.110.0090.00616.90
7.2.100.0020.01316.78
7.2.90.0040.01116.86
7.2.80.0040.01016.88
7.2.70.0070.00416.88
7.2.60.0080.00617.01
7.2.50.0120.00616.87
7.2.40.0060.00817.05
7.2.30.0070.00716.79
7.2.20.0050.01016.82
7.2.10.0030.01216.82
7.2.00.0090.00817.63
7.1.330.0030.01315.89
7.1.320.0070.00515.75
7.1.310.0050.00815.77
7.1.300.0050.01015.57
7.1.290.0070.00515.97
7.1.280.0050.00815.81
7.1.270.0030.00815.80
7.1.260.0040.01115.96
7.1.250.0050.00615.85
7.1.240.0060.00215.85
7.1.230.0030.00915.91
7.1.220.0050.01015.65
7.1.210.0080.00415.74
7.1.200.0070.01215.82
7.1.190.0060.00615.78
7.1.180.0060.00915.63
7.1.170.0030.00815.64
7.1.160.0090.00515.89
7.1.150.0020.00815.83
7.1.140.0040.01015.92
7.1.130.0100.00515.80
7.1.120.0070.00515.91
7.1.110.0030.00815.83
7.1.100.0030.01016.51
7.1.90.0090.00415.71
7.1.80.0040.01015.71
7.1.70.0030.00916.15
7.1.60.0080.00917.18
7.1.50.0100.00516.13
7.1.40.0030.00915.72
7.1.30.0090.00615.84
7.1.20.0030.00815.68
7.1.10.0000.01315.85
7.1.00.0020.03618.03
7.0.330.0100.00315.45
7.0.320.0030.00815.45
7.0.310.0050.01215.46
7.0.300.0070.00515.52
7.0.290.0060.00315.46
7.0.280.0060.00815.42
7.0.270.0030.00715.47
7.0.260.0030.00915.41
7.0.250.0030.00815.48
7.0.240.0050.00715.54
7.0.230.0040.00915.56
7.0.220.0060.00715.63
7.0.210.0020.01115.22
7.0.200.0020.01115.98
7.0.190.0000.01015.55
7.0.180.0030.00815.45
7.0.170.0060.00615.58
7.0.160.0060.00515.23
7.0.150.0050.00815.37
7.0.140.0050.02617.59
7.0.130.0020.01115.35
7.0.120.0080.00515.48
7.0.110.0050.00715.43
7.0.100.0060.01015.38
7.0.90.0070.03416.82
7.0.80.0080.02316.96
7.0.70.0050.01716.89
7.0.60.0070.03016.86
7.0.50.0040.03217.16
7.0.40.0040.03415.75
7.0.30.0060.03615.79
7.0.20.0070.02915.74
7.0.10.0060.03215.72
7.0.00.0050.01715.72
5.6.400.0060.00714.44
5.6.390.0040.00714.44
5.6.380.0050.00514.54
5.6.370.0060.00314.49
5.6.360.0070.00714.49
5.6.350.0040.01014.17
5.6.340.0060.00914.53
5.6.330.0060.00514.52
5.6.320.0040.01114.22
5.6.310.0020.01314.51
5.6.300.0030.00714.53
5.6.290.0050.00914.31
5.6.280.0080.02716.62
5.6.270.0050.01014.56
5.6.260.0050.00714.64
5.6.250.0020.01314.34
5.6.240.0080.00714.46
5.6.230.0040.03416.52
5.6.220.0080.01716.39
5.6.210.0040.02616.43
5.6.200.0080.03016.67
5.6.190.0050.03316.54
5.6.180.0060.01816.57
5.6.170.0090.02916.52
5.6.160.0050.02416.63
5.6.150.0070.02516.50
5.6.140.0060.03116.63
5.6.130.0040.02516.79
5.6.120.0070.03216.56
5.6.110.0080.03116.64
5.6.100.0030.02216.67
5.6.90.0030.03416.61
5.6.80.0040.02216.32
5.6.70.0050.03216.43
5.6.60.0040.02416.37
5.6.50.0040.02216.21
5.6.40.0060.03216.31
5.6.30.0050.03116.31
5.6.20.0100.01816.35
5.6.10.0040.03216.28
5.6.00.0040.03216.23
5.5.380.0050.00914.29
5.5.370.0020.03516.46
5.5.360.0050.02016.47
5.5.350.0070.03116.51
5.5.340.0030.02416.56
5.5.330.0080.01716.59
5.5.320.0080.03116.59
5.5.310.0060.03316.50
5.5.300.0120.02816.59
5.5.290.0100.01616.52
5.5.280.0090.02716.56
5.5.270.0050.03116.57
5.5.260.0050.03316.45
5.5.250.0050.03416.33
5.5.240.0080.03216.36
5.5.230.0060.03116.32
5.5.220.0020.02316.15
5.5.210.0090.03216.28
5.5.200.0070.02716.13
5.5.190.0030.02316.13
5.5.180.0060.02716.13
5.5.170.0060.00814.22
5.5.160.0020.02716.18
5.5.150.0100.02316.11
5.5.140.0100.02416.22
5.5.130.0060.02816.18
5.5.120.0120.01316.17
5.5.110.0060.02216.05
5.5.100.0040.03116.04
5.5.90.0050.01816.18
5.5.80.0080.02116.16
5.5.70.0060.02816.22
5.5.60.0060.03316.25
5.5.50.0080.03116.27
5.5.40.0040.03016.19
5.5.30.0040.02416.34
5.5.20.0070.01916.29
5.5.10.0080.01916.21
5.5.00.0050.01916.22
5.4.450.0030.02813.77
5.4.440.0060.03013.86
5.4.430.0050.02813.94
5.4.420.0060.01613.85
5.4.410.0040.02613.86
5.4.400.0080.01513.61
5.4.390.0030.02813.77
5.4.380.0050.02713.74
5.4.370.0090.02813.75
5.4.360.0040.03113.70
5.4.350.0110.02213.71
5.4.340.0010.02013.76
5.4.330.0070.00511.13
5.4.320.0050.03013.68
5.4.310.0010.02213.67
5.4.300.0020.02913.71
5.4.290.0030.03213.65
5.4.280.0060.02013.70
5.4.270.0070.02713.73
5.4.260.0070.02513.69
5.4.250.0060.02913.74
5.4.240.0030.01913.58
5.4.230.0030.03013.70
5.4.220.0040.02213.62
5.4.210.0060.03013.63
5.4.200.0060.03013.67
5.4.190.0040.03213.84
5.4.180.0040.03113.79
5.4.170.0040.01713.57
5.4.160.0020.03413.68
5.4.150.0040.03013.72
5.4.140.0080.01912.72
5.4.130.0080.02412.77
5.4.120.0040.02812.79
5.4.110.0050.03112.82
5.4.100.0040.02812.76
5.4.90.0080.01812.78
5.4.80.0050.02412.75
5.4.70.0040.03112.82
5.4.60.0080.02312.89
5.4.50.0040.02112.87
5.4.40.0030.02712.82
5.4.30.0080.01912.75
5.4.20.0010.02212.77
5.4.10.0090.02312.82
5.4.00.0060.02812.70
5.3.290.0060.02812.17
5.3.280.0040.02812.08
5.3.270.0060.01612.13
5.3.260.0050.02812.07
5.3.250.0050.01912.15
5.3.240.0080.02512.08
5.3.230.0040.01912.06
5.3.220.0040.01912.04
5.3.210.0070.01812.02
5.3.200.0070.01912.04
5.3.190.0070.02012.04
5.3.180.0050.02912.10
5.3.170.0050.01612.11
5.3.160.0050.02812.05
5.3.150.0030.02112.12
5.3.140.0070.02712.00
5.3.130.0030.03212.09
5.3.120.0040.02912.07
5.3.110.0080.02112.09
5.3.100.0010.03211.84
5.3.90.0030.03111.91
5.3.80.0030.02111.83
5.3.70.0030.03211.85
5.3.60.0020.03111.90
5.3.50.0030.02811.71
5.3.40.0080.02511.67
5.3.30.0090.02511.77
5.3.20.0040.02111.77
5.3.10.0040.02511.68
5.3.00.0040.02811.65
5.2.170.0030.04713.59
5.2.160.0000.06713.59
5.2.150.0130.04713.59
5.2.140.0100.05313.59
5.2.130.0070.04713.59
5.2.120.0100.05313.59
5.2.110.0030.06313.59
5.2.100.0000.04013.59
5.2.90.0030.04713.59
5.2.80.0030.03313.59
5.2.70.0100.02713.59
5.2.60.0070.04013.59
5.2.50.0030.06013.59
5.2.40.0070.04313.59
5.2.30.0030.03313.59
5.2.20.0070.05713.59
5.2.10.0030.05313.59
5.2.00.0100.04013.59
5.1.60.0070.04713.59
5.1.50.0030.04313.59
5.1.40.0000.04013.59
5.1.30.0030.05713.59
5.1.20.0100.05013.59
5.1.10.0070.03013.59
5.1.00.0130.04713.59
5.0.50.0030.04313.59
5.0.40.0030.04313.59
5.0.30.0030.05713.59
5.0.20.0030.04713.59
5.0.10.0030.04313.59
5.0.00.0000.05013.59
4.4.90.0000.04013.59
4.4.80.0030.03713.59
4.4.70.0000.04013.59
4.4.60.0030.03013.59
4.4.50.0000.03713.59
4.4.40.0100.05013.59
4.4.30.0000.02313.59
4.4.20.0000.02713.59
4.4.10.0030.03313.59
4.4.00.0000.05713.59
4.3.110.0030.03713.59
4.3.100.0070.03013.59
4.3.90.0070.03013.59
4.3.80.0000.04013.59
4.3.70.0030.02013.59
4.3.60.0000.02013.59
4.3.50.0030.03313.59
4.3.40.0030.05013.59
4.3.30.0000.03313.59
4.3.20.0030.03313.59
4.3.10.0000.03713.59
4.3.00.0000.02713.59

preferences:
50.47 ms | 400 KiB | 5 Q