3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getCharacter($index) { $chars = "0123456789ABCDEFGHIJKLMOPQRSTUVWabcdefghijklmnopqrstuvw"; $c = ord(substr($chars, $index % strlen($chars))); //return ord(substr($chars, ($index << $c) % strlen($chars))); return ($index << $c) & (pow(2, 32) - 1); } function main() { $array = array(176, 52, 608, 855); foreach ($array as $value) { echo "$value: " . getCharacter($value) . "\n"; } } main();

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.01318.50
8.3.50.0110.00422.04
8.3.40.0070.00718.89
8.3.30.0100.01019.04
8.3.20.0040.00420.16
8.3.10.0000.00822.09
8.3.00.0030.00522.32
8.2.180.0150.00416.32
8.2.170.0160.00318.89
8.2.160.0100.00722.96
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0000.00726.16
8.2.120.0000.00817.63
8.2.110.0030.00722.20
8.2.100.0090.00317.72
8.2.90.0030.00619.07
8.2.80.0050.00318.03
8.2.70.0000.00817.50
8.2.60.0090.00018.04
8.2.50.0030.00518.07
8.2.40.0000.00818.16
8.2.30.0000.00717.94
8.2.20.0000.00717.54
8.2.10.0000.00819.41
8.2.00.0040.00417.70
8.1.280.0100.00325.92
8.1.270.0000.00822.17
8.1.260.0060.00326.35
8.1.250.0060.00328.09
8.1.240.0090.00023.91
8.1.230.0100.00019.15
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0040.00417.41
8.1.180.0030.00618.10
8.1.170.0000.01118.52
8.1.160.0040.00421.93
8.1.150.0040.00418.56
8.1.140.0040.00417.50
8.1.130.0000.00717.83
8.1.120.0040.00417.41
8.1.110.0030.00517.43
8.1.100.0040.00317.48
8.1.90.0040.00417.42
8.1.80.0000.00717.52
8.1.70.0030.00317.38
8.1.60.0030.00617.49
8.1.50.0000.00817.41
8.1.40.0000.00717.54
8.1.30.0000.00717.59
8.1.20.0050.00317.58
8.1.10.0000.00717.42
8.1.00.0000.00717.41
8.0.300.0050.00218.77
8.0.290.0000.00717.05
8.0.280.0040.00418.54
8.0.270.0030.00317.26
8.0.260.0000.00816.83
8.0.250.0030.00317.00
8.0.240.0040.00416.93
8.0.230.0000.00716.98
8.0.220.0000.00716.85
8.0.210.0000.00716.90
8.0.200.0060.00016.94
8.0.190.0050.00316.81
8.0.180.0070.00016.94
8.0.170.0030.00616.98
8.0.160.0040.00416.76
8.0.150.0000.00716.87
8.0.140.0040.00416.93
8.0.130.0030.00313.29
8.0.120.0040.00416.77
8.0.110.0000.00716.92
8.0.100.0030.00516.89
8.0.90.0040.00416.71
8.0.80.0000.01516.90
8.0.70.0000.00716.94
8.0.60.0030.00516.80
8.0.50.0020.00516.84
8.0.30.0090.01417.23
8.0.20.0110.00917.40
8.0.10.0000.00717.08
8.0.00.0100.00716.67
7.4.330.0020.00215.03
7.4.320.0000.00616.55
7.4.300.0000.00616.63
7.4.290.0030.00516.40
7.4.280.0040.00416.48
7.4.270.0070.00016.61
7.4.260.0070.00016.63
7.4.250.0000.00716.48
7.4.240.0020.00516.54
7.4.230.0030.00316.63
7.4.220.0090.00916.57
7.4.210.0100.00616.67
7.4.200.0020.00516.62
7.4.190.0040.00416.67
7.4.160.0040.01216.53
7.4.150.0130.01317.40
7.4.140.0050.01217.86
7.4.130.0070.01116.60
7.4.120.0090.00916.42
7.4.110.0110.00616.56
7.4.100.0110.01016.57
7.4.90.0030.01416.55
7.4.80.0090.01119.39
7.4.70.0100.00716.52
7.4.60.0110.00516.55
7.4.50.0030.00616.21
7.4.40.0060.00622.77
7.4.30.0100.00616.41
7.4.00.0060.00315.04
7.3.330.0050.00013.34
7.3.320.0040.00313.13
7.3.310.0000.00716.41
7.3.300.0000.00716.38
7.3.290.0040.01116.28
7.3.280.0110.00716.31
7.3.270.0060.01617.40
7.3.260.0100.01416.43
7.3.250.0150.00316.51
7.3.240.0090.01416.49
7.3.230.0120.00916.41
7.3.210.0070.01016.46
7.3.200.0100.01319.39
7.3.190.0120.01216.66
7.3.180.0090.00616.55
7.3.170.0080.01116.64
7.3.160.0130.00316.42
7.3.120.0030.00614.78
7.2.330.0140.00716.49
7.2.320.0100.01016.60
7.2.310.0120.00616.75
7.2.300.0130.00416.64
7.2.290.0070.01016.55
7.2.60.0090.00316.67
7.2.00.0060.00919.53
7.1.200.0070.00715.61
7.1.100.0080.00318.04
7.1.70.0000.00817.30
7.1.60.0150.01119.82
7.1.50.0270.00734.87
7.1.00.0030.07322.32
7.0.200.0030.01116.75
7.0.140.0070.06022.04
7.0.60.0230.07319.94
7.0.50.0100.03717.89
7.0.40.0200.07320.37
7.0.30.0300.07720.09
7.0.20.0230.08020.24
7.0.10.0070.04320.07
7.0.00.0170.05020.16
5.6.280.0100.06720.86
5.6.210.0070.08320.61
5.6.200.0070.08318.16
5.6.190.0030.08720.62
5.6.180.0430.08020.67
5.6.170.0230.07720.55
5.6.160.0100.04720.39
5.6.150.0100.07018.23
5.6.140.0100.08018.15
5.6.130.0030.07718.18
5.6.120.0030.04321.04
5.6.110.0070.08720.99
5.6.100.0030.04021.03
5.6.90.0030.08720.98
5.6.80.0030.08720.38
5.5.350.0230.05320.30
5.5.340.0000.04017.96
5.5.330.0070.04020.44
5.5.320.0330.04020.23
5.5.310.0200.04720.39
5.5.300.0070.03717.98
5.5.290.0100.05318.00
5.5.280.0070.08020.76
5.5.270.0000.06020.84
5.5.260.0100.04720.68
5.5.250.0130.07020.62
5.5.240.0100.04020.29
5.4.450.0370.04719.50
5.4.440.0500.04719.27
5.4.430.0600.05319.57
5.4.420.0370.03719.42
5.4.410.0170.03719.41
5.4.400.0500.03318.86
5.4.390.0800.04319.24
5.4.380.0430.05318.72
5.4.370.0430.05018.62
5.4.360.0330.06318.73
5.4.350.0230.06018.50
5.4.340.0330.05318.76
5.4.320.0090.04012.51
5.4.310.0100.03512.50
5.4.300.0080.03712.51
5.4.290.0070.04712.50
5.4.280.0100.03812.40
5.4.270.0040.04112.40
5.4.260.0080.03812.40
5.4.250.0090.03912.40
5.4.240.0110.04012.40
5.4.230.0090.03712.39
5.4.220.0070.04412.39
5.4.210.0080.04012.40
5.4.200.0080.03812.40
5.4.190.0120.04912.38
5.4.180.0100.04912.39
5.4.170.0140.04412.40
5.4.160.0180.04312.39
5.4.150.0140.04512.38
5.4.140.0160.04112.07
5.4.130.0120.04612.05
5.4.120.0160.04112.02
5.4.110.0160.04212.02
5.4.100.0160.04412.01
5.4.90.0210.04412.02
5.4.80.0310.06212.02
5.4.70.0150.04412.01
5.4.60.0200.04012.01
5.4.50.0170.05312.00
5.4.40.0120.04612.00
5.4.30.0300.06011.99
5.4.20.0320.05611.99
5.4.10.0190.04011.99
5.4.00.0210.03811.48
5.3.290.0060.04712.80
5.3.280.0070.04612.71
5.3.270.0200.04912.72
5.3.260.0460.11312.72
5.3.250.0240.04712.72
5.3.240.0210.04312.72
5.3.230.0380.09012.71
5.3.220.0230.04912.68
5.3.210.0210.04312.68
5.3.200.0280.04912.68
5.3.190.0220.04412.68
5.3.180.0180.04712.67
5.3.170.0400.08512.67
5.3.160.0240.04112.67
5.3.150.0180.04312.67
5.3.140.0180.04212.66
5.3.130.0310.06412.66
5.3.120.0190.04212.66
5.3.110.0150.04812.66
5.3.100.0160.04512.13
5.3.90.0180.04412.11
5.3.80.0190.04412.10
5.3.70.0200.04112.09
5.3.60.0160.04412.08
5.3.50.0410.08412.03
5.3.40.0190.04012.02
5.3.30.0170.04012.00
5.3.20.0120.04711.77
5.3.10.0160.04011.73
5.3.00.0160.04011.71
5.2.170.0120.0359.22
5.2.160.0120.0349.22
5.2.150.0130.0349.21
5.2.140.0260.0519.21
5.2.130.0160.0309.18
5.2.120.0120.0359.17
5.2.110.0160.0349.19
5.2.100.0120.0359.18
5.2.90.0110.0359.19
5.2.80.0090.0389.18
5.2.70.0120.0369.18
5.2.60.0120.0369.13
5.2.50.0270.0809.09
5.2.40.0180.0299.08
5.2.30.0160.0359.05
5.2.20.0120.0359.05
5.2.10.0120.0348.95
5.2.00.0140.0338.80
5.1.60.0090.0308.09
5.1.50.0150.0268.08
5.1.40.0120.0288.07
5.1.30.0070.0358.41
5.1.20.0100.0328.45
5.1.10.0140.0298.17
5.1.00.0120.0308.16
5.0.50.0080.0266.64
5.0.40.0100.0226.50
5.0.30.0070.0376.32
5.0.20.0260.0366.29
5.0.10.0090.0236.27
5.0.00.0070.0376.25
4.4.90.0080.0174.78
4.4.80.0070.0184.75
4.4.70.0100.0154.75
4.4.60.0050.0204.75
4.4.50.0070.0184.77
4.4.40.0100.0264.71
4.4.30.0050.0214.76
4.4.20.0050.0204.84
4.4.10.0190.0364.85
4.4.00.0080.0274.76
4.3.110.0100.0144.67
4.3.100.0090.0154.67
4.3.90.0060.0184.63
4.3.80.0060.0284.58
4.3.70.0070.0174.63
4.3.60.0050.0184.63
4.3.50.0060.0194.63
4.3.40.0070.0264.54
4.3.30.0040.0193.33
4.3.20.0050.0183.32
4.3.10.0070.0153.28
4.3.00.0100.01715.60

preferences:
36.59 ms | 401 KiB | 5 Q