3v4l.org

run code in 300+ PHP versions simultaneously
<?php $accountNumber = '102705'; $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.0140.00318.34
8.3.50.0120.00721.87
8.3.40.0140.00318.70
8.3.30.0070.01019.05
8.3.20.0080.00020.34
8.3.10.0000.00820.38
8.3.00.0050.00519.25
8.2.180.0180.00418.04
8.2.170.0140.00322.96
8.2.160.0070.01020.50
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00422.11
8.2.110.0060.00322.29
8.2.100.0080.00318.22
8.2.90.0040.00419.35
8.2.80.0000.00817.97
8.2.70.0000.00917.63
8.2.60.0060.00617.93
8.2.50.0000.00818.07
8.2.40.0040.00418.16
8.2.30.0000.00718.06
8.2.20.0000.00717.64
8.2.10.0050.00218.07
8.2.00.0040.00417.80
8.1.280.0170.00325.92
8.1.270.0040.00422.19
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0140.00322.03
8.1.230.0040.00719.15
8.1.220.0080.00017.79
8.1.210.0080.00018.77
8.1.200.0000.00817.35
8.1.190.0030.00617.25
8.1.180.0080.00018.10
8.1.170.0040.00418.39
8.1.160.0060.00321.96
8.1.150.0040.00418.87
8.1.140.0040.00417.40
8.1.130.0000.00717.76
8.1.120.0000.00817.42
8.1.110.0040.00417.30
8.1.100.0000.00717.29
8.1.90.0030.00317.33
8.1.80.0040.00417.45
8.1.70.0030.00317.39
8.1.60.0040.00417.48
8.1.50.0040.00417.47
8.1.40.0040.00417.34
8.1.30.0000.00917.57
8.1.20.0000.00817.51
8.1.10.0040.00417.45
8.1.00.0070.00017.50
8.0.300.0070.00018.77
8.0.290.0060.00316.75
8.0.280.0040.00418.33
8.0.270.0040.00417.14
8.0.260.0030.00317.31
8.0.250.0000.00616.89
8.0.240.0030.00317.04
8.0.230.0030.00316.90
8.0.220.0070.00016.77
8.0.210.0040.00416.81
8.0.200.0060.00316.85
8.0.190.0050.00317.03
8.0.180.0000.00816.91
8.0.170.0030.00616.84
8.0.160.0000.00816.86
8.0.150.0030.00516.77
8.0.140.0040.00416.75
8.0.130.0000.00813.32
8.0.120.0050.00316.90
8.0.110.0040.00416.90
8.0.100.0000.00716.71
8.0.90.0000.00716.76
8.0.80.0110.00316.81
8.0.70.0050.00216.91
8.0.60.0030.00516.71
8.0.50.0080.00016.93
8.0.30.0090.00917.15
8.0.20.0030.01617.40
8.0.10.0020.00517.06
8.0.00.0070.01016.72
7.4.330.0000.00515.14
7.4.320.0060.00016.51
7.4.300.0030.00316.46
7.4.290.0030.00316.60
7.4.280.0000.00816.43
7.4.270.0040.00416.63
7.4.260.0050.00316.49
7.4.250.0040.00416.57
7.4.240.0060.00216.49
7.4.230.0000.00716.64
7.4.220.0140.00316.54
7.4.210.0090.00616.48
7.4.200.0000.00716.66
7.4.160.0120.00916.58
7.4.150.0120.01217.40
7.4.140.0080.01017.86
7.4.130.0100.01016.53
7.4.120.0060.01116.51
7.4.110.0090.00916.52
7.4.100.0120.00416.49
7.4.90.0080.00816.53
7.4.80.0070.01119.39
7.4.70.0100.00716.40
7.4.60.0000.01716.39
7.4.50.0000.00416.36
7.4.40.0060.01116.41
7.4.30.0070.01016.43
7.4.10.0120.00314.94
7.4.00.0110.00415.05
7.3.330.0000.00613.21
7.3.320.0030.00313.10
7.3.310.0070.00016.43
7.3.300.0030.00316.34
7.3.290.0060.00916.34
7.3.280.0130.00616.35
7.3.270.0090.00917.40
7.3.260.0120.01216.43
7.3.250.0160.00516.39
7.3.240.0060.01216.59
7.3.230.0090.00916.58
7.3.210.0100.01316.50
7.3.200.0060.01219.39
7.3.190.0130.01016.41
7.3.180.0090.00616.53
7.3.170.0040.01416.41
7.3.160.0130.00316.55
7.3.130.0120.00614.58
7.3.120.0130.00014.79
7.3.110.0040.01514.89
7.3.100.0040.01114.88
7.3.90.0040.01114.65
7.3.80.0030.01014.72
7.3.70.0130.00014.85
7.3.60.0060.00614.80
7.3.50.0080.00614.96
7.3.40.0000.01314.98
7.3.30.0040.01114.79
7.3.20.0090.00616.71
7.3.10.0060.00616.52
7.3.00.0060.00416.56
7.2.330.0110.00716.54
7.2.320.0070.01016.75
7.2.310.0110.00616.65
7.2.300.0000.01616.63
7.2.290.0130.01016.73
7.2.260.0060.01214.95
7.2.250.0030.01415.16
7.2.240.0090.00615.06
7.2.230.0150.00415.18
7.2.220.0000.01715.20
7.2.210.0070.00714.72
7.2.200.0090.00315.01
7.2.190.0000.01615.16
7.2.180.0030.01215.14
7.2.170.0070.00715.12
7.2.160.0000.01214.65
7.2.150.0060.00916.96
7.2.140.0100.00716.65
7.2.130.0010.01216.80
7.2.120.0060.00517.03
7.2.110.0080.00616.94
7.2.100.0060.00917.05
7.2.90.0080.00816.80
7.2.80.0060.00516.96
7.2.70.0080.00516.98
7.2.60.0030.01016.91
7.2.50.0070.00516.82
7.2.40.0070.00817.03
7.2.30.0050.00916.77
7.2.20.0050.00616.82
7.2.10.0050.00716.92
7.2.00.0050.01017.51
7.1.330.0040.01115.90
7.1.320.0070.01015.88
7.1.310.0030.00615.96
7.1.300.0090.00315.91
7.1.290.0000.00915.84
7.1.280.0070.00715.76
7.1.270.0060.00615.92
7.1.260.0030.00615.54
7.1.250.0030.00915.73
7.1.240.0070.00715.91
7.1.230.0000.01715.67
7.1.220.0050.00515.73
7.1.210.0040.00815.70
7.1.200.0070.00715.55
7.1.190.0080.00615.84
7.1.180.0040.01115.79
7.1.170.0110.00315.85
7.1.160.0060.01315.88
7.1.150.0000.01715.75
7.1.140.0110.00415.75
7.1.130.0000.01315.88
7.1.120.0060.00615.94
7.1.110.0060.00915.95
7.1.100.0040.00916.93
7.1.90.0030.00715.65
7.1.80.0040.00815.76
7.1.70.0020.01016.60
7.1.60.0070.01117.56
7.1.50.0020.01016.38
7.1.40.0040.00815.93
7.1.30.0030.00916.00
7.1.20.0070.00715.77
7.1.10.0110.00315.90
7.1.00.0110.03619.06
7.0.330.0030.01015.25
7.0.320.0000.01115.28
7.0.310.0070.00715.51
7.0.300.0030.00915.32
7.0.290.0120.00415.48
7.0.280.0130.00615.14
7.0.270.0050.00515.29
7.0.260.0090.00615.53
7.0.250.0100.00715.51
7.0.240.0060.00915.34
7.0.230.0000.01315.27
7.0.220.0000.01115.46
7.0.210.0110.00315.42
7.0.200.0010.00716.24
7.0.190.0030.01415.51
7.0.180.0090.00615.24
7.0.170.0110.00015.43
7.0.160.0070.00715.57
7.0.150.0000.01415.46
7.0.140.0090.03818.81
7.0.130.0060.00315.53
7.0.120.0030.01015.21
7.0.110.0100.00715.20
7.0.100.0080.00815.39
7.0.90.0080.00815.32
7.0.80.0080.00415.51
7.0.70.0120.00315.32
7.0.60.0070.02417.71
7.0.50.0020.03916.75
7.0.40.0080.03916.94
7.0.30.0150.02816.76
7.0.20.0200.03716.93
7.0.10.0030.05316.76
7.0.00.0070.03516.74
5.6.400.0030.00914.44
5.6.390.0070.01014.48
5.6.380.0130.00014.39
5.6.370.0060.00914.45
5.6.360.0000.00814.18
5.6.350.0000.01914.28
5.6.340.0040.01414.21
5.6.330.0070.00414.04
5.6.320.0110.00014.66
5.6.310.0000.01114.56
5.6.300.0100.00314.68
5.6.290.0070.01014.64
5.6.280.0030.04317.70
5.6.270.0120.00614.18
5.6.260.0030.01214.68
5.6.250.0070.00714.55
5.6.240.0000.01114.09
5.6.230.0030.00714.35
5.6.220.0040.01114.62
5.6.210.0090.04517.43
5.6.200.0070.04016.30
5.6.190.0020.04417.54
5.6.180.0200.04517.54
5.6.170.0170.04217.48
5.6.160.0030.04917.31
5.6.150.0080.03516.23
5.6.140.0090.04216.17
5.6.130.0090.02416.23
5.6.120.0020.02517.66
5.6.110.0120.03717.85
5.6.100.0050.04917.80
5.6.90.0060.02417.56
5.6.80.0090.03117.48
5.6.70.0080.00814.41
5.6.60.0000.01314.22
5.6.50.0070.00714.34
5.6.40.0100.00314.14
5.6.30.0000.01514.43
5.6.20.0140.00314.09
5.6.10.0080.00614.42
5.6.00.0040.01114.52
5.5.380.0070.00714.29
5.5.370.0090.00614.73
5.5.360.0060.00914.33
5.5.350.0120.02717.36
5.5.340.0040.02216.12
5.5.330.0050.02317.12
5.5.320.0220.04117.50
5.5.310.0190.03317.35
5.5.300.0070.04516.07
5.5.290.0040.03116.35
5.5.280.0070.03417.73
5.5.270.0080.04517.68
5.5.260.0040.05217.68
5.5.250.0140.03517.64
5.5.240.0200.02017.26
5.5.230.0060.00314.43
5.5.220.0030.00614.37
5.5.210.0070.01014.10
5.5.200.0070.00714.30
5.5.190.0000.01314.34
5.5.180.0070.01114.31
5.5.170.0000.01314.50
5.5.160.0000.01414.45
5.5.150.0100.00714.26
5.5.140.0040.01114.20
5.5.130.0030.00914.47
5.5.120.0060.00914.10
5.5.110.0120.00014.50
5.5.100.0080.00614.22
5.5.90.0000.01314.10
5.5.80.0120.00314.12
5.5.70.0060.00614.20
5.5.60.0000.00814.42
5.5.50.0000.01314.13
5.5.40.0000.00914.07
5.5.30.0000.00813.89
5.5.20.0000.01013.89
5.5.10.0060.00614.07
5.5.00.0090.00014.09
5.4.450.0400.02015.24
5.4.440.0370.02015.20
5.4.430.0480.02315.34
5.4.420.0330.00615.32
5.4.410.0330.00415.31
5.4.400.0430.00515.03
5.4.390.0350.00315.21
5.4.380.0350.00214.97
5.4.370.0380.00314.84
5.4.360.0300.00315.13
5.4.350.0330.00215.01
5.4.340.0330.00315.07
5.4.330.0030.00710.81
5.4.320.0060.02511.87
5.4.310.0070.02311.72
5.4.300.0050.02611.74
5.4.290.0060.02611.86
5.4.280.0090.01911.63
5.4.270.0050.02211.65
5.4.260.0050.02611.66
5.4.250.0080.02411.71
5.4.240.0020.02811.61
5.4.230.0050.02511.76
5.4.220.0070.01911.50
5.4.210.0040.02211.66
5.4.200.0040.02411.70
5.4.190.0090.01811.79
5.4.180.0050.02211.68
5.4.170.0080.02011.64
5.4.160.0020.02311.77
5.4.150.0100.01711.58
5.4.140.0040.02411.41
5.4.130.0050.02411.49
5.4.120.0080.01811.49
5.4.110.0070.02011.54
5.4.100.0080.02411.47
5.4.90.0030.02411.45
5.4.80.0020.02311.61
5.4.70.0080.02211.49
5.4.60.0040.02211.50
5.4.50.0070.02011.42
5.4.40.0050.02011.55
5.4.30.0050.02311.50
5.4.20.0060.02211.38
5.4.10.0040.01911.36
5.4.00.0070.01711.24
5.3.290.0100.03912.80
5.3.280.0070.04312.71
5.3.270.0080.03812.72
5.3.260.0050.04712.72
5.3.250.0050.04412.72
5.3.240.0100.04312.72
5.3.230.0120.04312.71
5.3.220.0070.04712.68
5.3.210.0100.05412.68
5.3.200.0090.04812.68
5.3.190.0060.05012.68
5.3.180.0070.04012.67
5.3.170.0090.05312.67
5.3.160.0130.04312.68
5.3.150.0110.03812.68
5.3.140.0120.03112.66
5.3.130.0080.04612.66
5.3.120.0060.03912.66
5.3.110.0070.03812.66
5.3.100.0060.04012.12
5.3.90.0070.03612.08
5.3.80.0100.03512.07
5.3.70.0090.03612.07
5.3.60.0100.03412.06
5.3.50.0070.03512.00
5.3.40.0060.03612.00
5.3.30.0110.03011.96
5.3.20.0120.03011.73
5.3.10.0100.03311.70
5.3.00.0070.03811.69
5.2.170.0090.0309.19
5.2.160.0070.0339.19
5.2.150.0080.0359.19
5.2.140.0120.0339.19
5.2.130.0040.0359.15
5.2.120.0050.0339.15
5.2.110.0060.0329.16
5.2.100.0090.0319.15
5.2.90.0060.0339.15
5.2.80.0060.0329.15
5.2.70.0060.0359.14
5.2.60.0040.0339.10
5.2.50.0060.0439.07
5.2.40.0050.0309.05
5.2.30.0140.0599.02
5.2.20.0040.0359.01
5.2.10.0050.0298.93
5.2.00.0080.0348.79
5.1.60.0040.0248.08
5.1.50.0080.0248.08
5.1.40.0070.0278.05
5.1.30.0060.0278.40
5.1.20.0090.0308.43
5.1.10.0030.0288.16
5.1.00.0070.0258.16
5.0.50.0040.0216.64
5.0.40.0030.0216.50
5.0.30.0030.0336.31
5.0.20.0040.0196.28
5.0.10.0030.0206.25
5.0.00.0020.0326.25
4.4.90.0020.0174.77
4.4.80.0030.0154.75
4.4.70.0050.0174.75
4.4.60.0060.0134.76
4.4.50.0060.0154.77
4.4.40.0040.0254.70
4.4.30.0040.0164.76
4.4.20.0040.0164.84
4.4.10.0010.0174.85
4.4.00.0050.0234.76
4.3.110.0040.0144.66
4.3.100.0040.0134.66
4.3.90.0030.0154.63
4.3.80.0070.0214.58
4.3.70.0030.0144.63
4.3.60.0040.0134.63
4.3.50.0020.0164.63
4.3.40.0020.0244.54
4.3.30.0010.0173.30
4.3.20.0000.0183.28
4.3.10.0010.0163.24
4.3.00.0330.0134.50

preferences:
41.7 ms | 401 KiB | 5 Q