3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strNewAcctNum = ''; $accountNumber = '123us'; $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.0110.00418.43
8.3.50.0100.01022.02
8.3.40.0040.01118.59
8.3.30.0070.00718.84
8.3.20.0040.00420.29
8.3.10.0040.00421.85
8.3.00.0040.00417.89
8.2.180.0060.01216.32
8.2.170.0070.00722.96
8.2.160.0100.00320.11
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0060.00326.16
8.2.120.0000.00720.71
8.2.110.0030.00619.25
8.2.100.0120.00017.91
8.2.90.0000.00819.22
8.2.80.0040.00417.97
8.2.70.0080.00017.50
8.2.60.0040.00418.05
8.2.50.0000.00918.10
8.2.40.0050.00518.34
8.2.30.0000.00818.02
8.2.20.0080.00017.66
8.2.10.0000.00818.20
8.2.00.0040.00417.63
8.1.280.0070.00725.92
8.1.270.0030.00623.96
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0060.00321.37
8.1.230.0080.00317.65
8.1.220.0000.00817.78
8.1.210.0030.00618.77
8.1.200.0040.00417.25
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0090.00018.46
8.1.160.0050.00321.92
8.1.150.0000.00718.83
8.1.140.0030.00617.27
8.1.130.0030.00317.71
8.1.120.0030.00517.30
8.1.110.0000.00717.40
8.1.100.0000.00717.46
8.1.90.0000.00717.31
8.1.80.0040.00417.44
8.1.70.0050.00317.39
8.1.60.0030.00517.43
8.1.50.0040.00417.41
8.1.40.0000.01017.48
8.1.30.0040.00417.48
8.1.20.0000.00817.66
8.1.10.0000.00817.47
8.1.00.0030.00517.45
8.0.300.0080.00018.77
8.0.290.0050.00516.75
8.0.280.0000.00718.47
8.0.270.0070.00017.26
8.0.260.0070.00017.18
8.0.250.0070.00016.84
8.0.240.0030.00316.97
8.0.230.0000.00716.88
8.0.220.0070.00016.84
8.0.210.0000.00816.96
8.0.200.0000.00716.93
8.0.190.0050.00216.96
8.0.180.0000.00916.90
8.0.170.0050.00216.89
8.0.160.0070.00016.77
8.0.150.0070.00016.87
8.0.140.0000.00816.76
8.0.130.0060.00013.30
8.0.120.0040.00416.83
8.0.110.0040.00416.76
8.0.100.0000.00716.88
8.0.90.0000.00716.93
8.0.80.0140.00716.95
8.0.70.0000.00816.93
8.0.60.0050.00316.88
8.0.50.0040.00416.95
8.0.30.0110.00817.05
8.0.20.0170.00517.40
8.0.10.0040.00417.00
8.0.00.0070.01016.69
7.4.330.0020.00215.08
7.4.320.0030.00316.51
7.4.300.0000.00616.58
7.4.290.0030.00716.48
7.4.280.0000.00716.52
7.4.270.0040.00416.58
7.4.260.0080.00316.57
7.4.250.0070.00016.59
7.4.240.0020.00516.51
7.4.230.0050.00316.59
7.4.220.0080.00916.46
7.4.210.0110.00316.56
7.4.200.0040.00416.45
7.4.160.0000.02016.59
7.4.150.0100.01317.40
7.4.140.0100.00817.86
7.4.130.0080.00816.50
7.4.120.0060.01016.57
7.4.110.0100.00616.33
7.4.100.0070.01316.58
7.4.90.0090.00916.55
7.4.80.0030.01319.39
7.4.70.0140.00316.52
7.4.60.0060.01216.45
7.4.50.0040.00416.23
7.4.40.0090.00616.54
7.4.30.0040.01216.32
7.4.00.0060.01214.69
7.3.330.0000.00613.33
7.3.320.0020.00213.06
7.3.310.0040.00416.28
7.3.300.0070.00016.30
7.3.290.0070.00716.37
7.3.280.0030.01216.31
7.3.270.0030.01417.40
7.3.260.0160.00316.73
7.3.250.0090.01016.60
7.3.240.0090.00816.35
7.3.230.0140.00316.39
7.3.210.0110.00716.66
7.3.200.0100.01119.39
7.3.190.0150.00916.57
7.3.180.0160.00316.42
7.3.170.0110.01116.61
7.3.160.0130.00316.35
7.3.120.0110.00315.09
7.3.10.0030.00616.71
7.3.00.0040.00716.61
7.2.330.0100.01016.54
7.2.320.0070.01016.41
7.2.310.0120.00916.56
7.2.300.0070.01016.59
7.2.290.0070.01016.63
7.2.130.0080.00816.97
7.2.120.0000.01517.06
7.2.110.0070.01117.03
7.2.100.0090.00616.74
7.2.90.0060.00916.62
7.2.80.0070.00717.04
7.2.70.0060.00316.80
7.2.60.0030.00716.85
7.2.50.0060.01217.04
7.2.40.0040.01016.74
7.2.30.0070.00717.05
7.2.20.0140.00316.98
7.2.10.0090.00317.06
7.2.00.0040.00718.19
7.1.250.0030.01015.82
7.1.100.0040.01117.82
7.1.70.0040.00417.22
7.1.60.0120.00919.25
7.1.50.0030.01016.98
7.1.00.0000.08022.34
7.0.200.0000.00916.48
7.0.140.0070.07022.14
7.0.60.0070.06719.98
7.0.50.0030.08717.66
7.0.40.0170.07020.09
7.0.30.0370.07320.30
7.0.20.0200.05020.11
7.0.10.0030.08020.20
7.0.00.0030.04720.13
5.6.280.0070.07021.08
5.6.210.0000.06720.70
5.6.200.0070.04718.20
5.6.190.0070.05320.61
5.6.180.0270.04720.40
5.6.170.0270.07720.38
5.6.160.0130.06320.48
5.6.150.0030.07718.12
5.6.140.0100.07718.16
5.6.130.0100.07318.23
5.6.120.0100.06720.99
5.6.110.0200.07720.99
5.6.100.0100.03721.01
5.6.90.0170.07321.13
5.6.80.0000.04320.38
5.5.350.0030.04320.47
5.5.340.0070.08318.02
5.5.330.0000.08720.07
5.5.320.0070.05020.29
5.5.310.0430.06720.34
5.5.300.0100.08017.88
5.5.290.0030.05018.00
5.5.280.0030.08720.69
5.5.270.0030.08320.87
5.5.260.0070.04020.77
5.5.250.0000.05020.70
5.5.240.4000.04320.17
5.4.450.0400.04019.26
5.4.440.0430.04319.24
5.4.430.0430.03319.45
5.4.420.0600.05319.51
5.4.410.0300.03318.97
5.4.400.0500.04019.08
5.4.390.0200.04319.13
5.4.380.0200.05718.62
5.4.370.0270.04718.61
5.4.360.0170.05018.50
5.4.350.0100.06318.53
5.4.340.0200.04718.66
5.4.320.0070.03512.46
5.4.310.0040.04112.46
5.4.300.0050.03712.46
5.4.290.0070.04012.46
5.4.280.0080.03912.36
5.4.270.0020.04012.36
5.4.260.0030.04012.36
5.4.250.0090.03812.36
5.4.240.0070.03412.36
5.4.230.0110.04012.35
5.4.220.0060.03612.35
5.4.210.0070.03412.35
5.4.200.0060.03912.35
5.4.190.0050.03712.35
5.4.180.0080.03512.35
5.4.170.0070.03612.36
5.4.160.0050.03612.36
5.4.150.0060.03712.35
5.4.140.0070.03712.03
5.4.130.0050.03512.02
5.4.120.0060.03411.98
5.4.110.0080.03711.98
5.4.100.0050.03811.97
5.4.90.0060.03911.97
5.4.80.0080.03811.97
5.4.70.0060.03911.96
5.4.60.0090.03211.97
5.4.50.0050.03511.97
5.4.40.0060.03411.95
5.4.30.0050.03611.95
5.4.20.0040.03611.96
5.4.10.0030.03711.95
5.4.00.0070.03711.45
5.3.290.0040.04012.80
5.3.280.0060.03812.71
5.3.270.0070.04112.72
5.3.260.0060.04112.72
5.3.250.0060.03812.72
5.3.240.0080.03812.71
5.3.230.0050.04012.71
5.3.220.0050.04212.68
5.3.210.0080.03812.68
5.3.200.0040.03812.68
5.3.190.0060.03712.68
5.3.180.0050.03712.67
5.3.170.0050.04412.67
5.3.160.0060.03612.68
5.3.150.0070.03612.68
5.3.140.0050.03812.66
5.3.130.0030.04112.66
5.3.120.0070.03912.66
5.3.110.0040.04012.66
5.3.100.0100.03212.12
5.3.90.0050.04112.08
5.3.80.0100.03612.07
5.3.70.0120.04112.08
5.3.60.0070.03512.07
5.3.50.0090.03312.00
5.3.40.0040.03812.00
5.3.30.0040.03611.96
5.3.20.0060.04011.73
5.3.10.0060.03511.70
5.3.00.0070.03811.69
5.2.170.0030.0329.20
5.2.160.0060.0359.20
5.2.150.0040.0329.19
5.2.140.0020.0329.19
5.2.130.0040.0309.15
5.2.120.0100.0309.15
5.2.110.0040.0299.15
5.2.100.0060.0299.15
5.2.90.0040.0299.15
5.2.80.0050.0289.14
5.2.70.0050.0329.15
5.2.60.0020.0329.11
5.2.50.0060.0359.07
5.2.40.0070.0259.05
5.2.30.0060.0289.02
5.2.20.0050.0359.01
5.2.10.0040.0328.93
5.2.00.0050.0288.79
5.1.60.0050.0238.08
5.1.50.0040.0308.08
5.1.40.0060.0338.05
5.1.30.0060.0258.41
5.1.20.0050.0298.43
5.1.10.0020.0308.15
5.1.00.0020.0288.15
5.0.50.0030.0206.63
5.0.40.0030.0196.50
5.0.30.0020.0326.31
5.0.20.0070.0256.28
5.0.10.0030.0216.25
5.0.00.0030.0316.25
4.4.90.0000.0184.78
4.4.80.0060.0114.75
4.4.70.0030.0154.75
4.4.60.0020.0154.76
4.4.50.0020.0174.77
4.4.40.0030.0244.71
4.4.30.0030.0154.76
4.4.20.0050.0164.84
4.4.10.0040.0164.85
4.4.00.0040.0264.76
4.3.110.0040.0194.67
4.3.100.0040.0174.66
4.3.90.0030.0174.63
4.3.80.0040.0264.58
4.3.70.0070.0104.63
4.3.60.0020.0154.63
4.3.50.0020.0164.63
4.3.40.0050.0224.54
4.3.30.0040.0213.30
4.3.20.0020.0153.28
4.3.10.0020.0153.24
4.3.00.0070.01715.28

preferences:
38.6 ms | 401 KiB | 5 Q