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))); } function main() { $array = array(176, 52, 608, 855); foreach ($array as $value) { echo "$value: " . getCharacter($value) . "\n"; } } //main(); $index = 855; $chars = "0123456789ABCDEFGHIJKLMOPQRSTUVWabcdefghijklmnopqrstuvw"; $length = strlen($chars); $per = $index % $length; $subst = substr($chars, $per); $disp = ord($subst); echo "Length: $length\n"; echo "Perc: $per\n"; echo "Substr: $subst\n"; echo "disp: $disp\n";

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.00716.63
8.3.50.0110.01017.20
8.3.40.0070.00718.57
8.3.30.0110.00418.53
8.3.20.0050.00318.63
8.3.10.0060.00318.68
8.3.00.0060.00319.38
8.2.180.0090.00616.48
8.2.170.0070.00722.96
8.2.160.0100.00721.05
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0050.00320.49
8.2.110.0070.00319.41
8.2.100.0070.00417.84
8.2.90.0040.00721.21
8.2.80.0050.00219.38
8.2.70.0030.00617.63
8.2.60.0090.00017.93
8.2.50.0040.00418.07
8.2.40.0040.00418.16
8.2.30.0000.00818.12
8.2.20.0080.00017.78
8.2.10.0080.00017.76
8.2.00.0040.00417.67
8.1.280.0100.00725.92
8.1.270.0050.00224.66
8.1.260.0080.00826.35
8.1.250.0080.00028.09
8.1.240.0150.00622.48
8.1.230.0090.00320.88
8.1.220.0030.00617.78
8.1.210.0060.00318.90
8.1.200.0040.00417.25
8.1.190.0040.00417.51
8.1.180.0080.00018.10
8.1.170.0060.00318.96
8.1.160.0000.00718.85
8.1.150.0000.00718.55
8.1.140.0030.00517.41
8.1.130.0070.00017.83
8.1.120.0000.00717.44
8.1.110.0000.00717.38
8.1.100.0000.00717.29
8.1.90.0070.00017.37
8.1.80.0040.00417.42
8.1.70.0030.00317.36
8.1.60.0030.00617.57
8.1.50.0040.00417.45
8.1.40.0030.00617.48
8.1.30.0000.00817.63
8.1.20.0080.00017.55
8.1.10.0000.00717.46
8.1.00.0050.00217.34
8.0.300.0070.00020.03
8.0.290.0000.00716.63
8.0.280.0070.00018.34
8.0.270.0000.00717.27
8.0.260.0000.00616.79
8.0.250.0050.00316.99
8.0.240.0000.00816.96
8.0.230.0030.00316.98
8.0.220.0030.00316.82
8.0.210.0040.00416.84
8.0.200.0080.00016.86
8.0.190.0080.00016.84
8.0.180.0030.00316.82
8.0.170.0050.00316.86
8.0.160.0000.00716.91
8.0.150.0030.00516.84
8.0.140.0100.00016.76
8.0.130.0000.00513.36
8.0.120.0040.00416.84
8.0.110.0000.00816.90
8.0.100.0030.00516.77
8.0.90.0000.00716.82
8.0.80.0040.01116.83
8.0.70.0040.00416.73
8.0.60.0000.00816.81
8.0.50.0070.00017.02
8.0.30.0110.00816.98
8.0.20.0150.00616.90
8.0.10.0080.00017.09
8.0.00.0130.00516.86
7.4.330.0050.00012.97
7.4.320.0000.00916.32
7.4.300.0030.00316.45
7.4.290.0030.00316.60
7.4.280.0000.00716.56
7.4.270.0000.00816.54
7.4.260.0000.00813.21
7.4.250.0080.00016.55
7.4.240.0030.00416.53
7.4.230.0030.00316.57
7.4.220.0130.01316.58
7.4.210.0070.00916.58
7.4.200.0040.00416.54
7.4.190.0020.00516.40
7.4.160.0130.01016.62
7.4.150.0000.01616.57
7.4.140.0140.00616.50
7.4.130.0090.01216.40
7.4.120.0080.00916.41
7.4.110.0120.00616.25
7.4.100.0070.01716.45
7.4.90.0140.00316.44
7.4.80.0030.01416.34
7.4.70.0150.00616.63
7.4.60.0120.00616.56
7.4.50.0040.00816.43
7.4.40.0040.01216.30
7.4.30.0060.01716.46
7.4.00.0090.00714.90
7.3.330.0060.00013.28
7.3.320.0030.00313.14
7.3.310.0030.00316.18
7.3.300.0030.00316.31
7.3.290.0090.01216.30
7.3.280.0140.00216.28
7.3.270.0080.00816.33
7.3.260.0150.00316.34
7.3.250.0140.00416.50
7.3.240.0090.01116.24
7.3.230.0130.00416.37
7.3.210.0000.01616.30
7.3.200.0110.01119.39
7.3.190.0060.01216.51
7.3.180.0070.01016.33
7.3.170.0110.01316.45
7.3.160.0070.01016.24
7.3.120.0050.01014.71
7.3.110.0030.01314.60
7.3.100.0040.01214.94
7.3.90.0070.00314.65
7.3.80.0030.00914.74
7.3.70.0090.00914.81
7.3.60.0040.01114.41
7.3.50.0040.00714.99
7.3.40.0110.00314.98
7.3.30.0040.00714.60
7.3.20.0040.00816.59
7.3.10.0120.00316.75
7.3.00.0040.01216.76
7.2.330.0120.00616.48
7.2.320.0030.01416.44
7.2.310.0160.02016.52
7.2.300.0100.00716.36
7.2.290.0160.00016.68
7.2.250.0030.01314.98
7.2.240.0090.00915.01
7.2.230.0070.00715.12
7.2.220.0030.00614.74
7.2.210.0060.00914.95
7.2.200.0090.00614.93
7.2.190.0030.01015.11
7.2.180.0090.00614.95
7.2.170.0100.00714.84
7.1.330.0000.01515.48
7.1.320.0070.00715.80
7.1.310.0040.00715.66
7.1.300.0070.00715.87
7.1.290.0030.00615.66
7.1.280.0140.00015.62
7.1.270.0060.00915.85
7.1.260.0080.00815.82
7.1.70.0000.00817.18
7.1.60.0070.01719.40
7.1.50.0100.01316.98
7.1.00.0030.06022.43
7.0.200.0030.00316.43
7.0.140.0030.07322.07
7.0.120.0070.06722.17
7.0.60.0270.07720.06
7.0.50.0070.04017.86
7.0.40.0230.04320.09
7.0.30.0200.04020.17
7.0.20.0200.04020.11
7.0.10.0170.04320.10
7.0.00.0200.04020.04
5.6.210.0170.04320.52
5.6.200.0130.08018.16
5.6.190.0300.03720.41
5.6.180.0230.04020.63
5.6.170.0130.04720.41
5.6.160.0170.04320.51
5.6.150.0170.04320.30
5.6.140.0230.03720.18
5.6.130.0230.04320.34
5.6.120.0100.05020.44
5.6.110.0130.04720.33
5.6.100.0200.04720.33
5.6.90.0200.05020.39
5.6.80.0170.04019.71
5.6.70.0200.03719.79
5.6.60.0130.04319.54
5.6.50.0170.04719.88
5.6.40.0230.03319.86
5.6.30.0400.06019.70
5.6.20.0230.07719.86
5.6.10.0370.05019.70
5.6.00.0230.04319.68
5.5.350.0100.04720.31
5.5.340.0030.08717.96
5.5.330.0270.05720.43
5.5.320.0130.05020.41
5.5.310.0200.04020.57
5.5.300.0200.04020.14
5.5.290.0170.04320.04
5.5.280.0170.04319.98
5.5.270.0270.03320.03
5.5.260.0230.04020.29
5.5.250.0230.03719.94
5.5.240.0230.03319.60
5.5.230.0230.03319.67
5.5.220.0230.04019.68
5.5.210.0230.03319.37
5.5.200.0200.04019.33
5.5.190.0270.05319.65
5.5.180.0270.08019.32
5.5.160.0230.04719.47
5.5.150.0230.08319.49
5.5.140.0470.06019.55
5.5.130.0470.06019.48
5.5.120.0230.05319.64
5.5.110.0400.06319.58
5.5.100.0300.06319.39
5.5.90.0270.07719.23
5.5.80.0330.05319.37
5.5.70.0370.06019.22
5.5.60.0270.07719.27
5.5.50.0300.07319.21
5.5.40.0300.07719.47
5.5.30.0300.07719.28
5.5.20.0270.07019.61
5.5.10.0300.07019.52
5.5.00.0300.06719.41
5.4.450.0200.03719.52
5.4.440.0270.03019.57
5.4.430.0170.04719.57
5.4.420.0200.04319.40
5.4.410.0230.03319.41
5.4.400.0200.03318.86
5.4.390.0230.04018.87
5.4.380.0200.04319.16
5.4.370.0130.04019.21
5.4.360.0200.03319.11
5.4.350.0300.04019.05
5.4.340.0270.06718.88
5.4.320.0200.04019.12
5.4.310.0430.05319.11
5.4.300.0300.03319.14
5.4.290.0330.06719.24
5.4.280.0330.05318.85
5.4.270.0300.06319.13
5.4.260.0270.06718.86
5.4.250.0230.04019.25
5.4.240.0270.04719.11
5.4.230.0300.07719.11
5.4.220.0330.05719.14
5.4.210.0330.06719.00
5.4.200.0330.06719.14
5.4.190.0430.03718.84
5.4.180.0300.07018.92
5.4.170.0370.07019.23
5.4.160.0330.07318.96
5.4.150.0300.06719.14
5.4.140.0300.05716.59
5.4.130.0300.06316.42
5.4.120.0300.05016.42
5.4.110.0400.03316.46
5.4.100.0330.06016.35
5.4.90.0270.07016.35
5.4.80.0270.03716.32
5.4.70.0230.03716.57
5.4.60.0270.05316.32
5.4.50.0370.05316.41
5.4.40.0370.06016.36
5.4.30.0230.05016.35
5.4.20.0400.06316.41
5.4.10.0300.06716.26
5.4.00.0270.05715.82
5.3.290.0300.07014.74
5.3.280.0270.05714.62
5.3.270.0230.04714.65
5.3.260.0300.07014.75
5.3.250.0300.07314.67
5.3.240.0300.06314.66
5.3.230.0370.06314.61
5.3.220.0300.05014.63
5.3.210.0270.05314.57
5.3.200.0270.07314.57
5.3.190.0230.04714.63
5.3.180.0230.06714.60
5.3.170.0300.04014.71
5.3.160.0270.06014.71
5.3.150.0270.07714.63
5.3.140.0300.07014.57
5.3.130.0470.04314.58
5.3.120.0400.04314.58
5.3.110.0300.03714.55
5.3.100.0200.04314.04
5.3.90.0170.04314.02
5.3.80.0230.03714.07
5.3.70.0230.03714.08
5.3.60.0300.03014.04
5.3.50.0270.05713.95
5.3.40.0300.06714.00
5.3.30.0270.06313.80
5.3.20.0230.03713.65
5.3.10.0270.03713.71
5.3.00.0270.06713.68
5.2.170.0300.06012.83
5.2.160.0230.04312.83
5.2.150.0270.03012.83
5.2.140.0230.06312.83
5.2.130.0300.02012.83
5.2.120.0230.03312.83
5.2.110.0200.05712.83
5.2.100.0300.05012.83
5.2.90.0200.04012.83
5.2.80.0230.06012.83
5.2.70.0230.06012.83
5.2.60.0230.05712.83
5.2.50.0330.04712.83
5.2.40.0200.04712.83
5.2.30.0170.04012.83
5.2.20.0100.04712.83
5.2.10.0230.05712.83
5.2.00.0170.06012.83
5.1.60.0200.05312.83
5.1.50.0200.04712.83
5.1.40.0230.05012.83
5.1.30.0170.05712.83
5.1.20.0230.02312.83
5.1.10.0200.05312.83
5.1.00.0370.02312.83
5.0.50.0100.03012.83
5.0.40.0170.02312.83
5.0.30.0070.03712.83
5.0.20.0100.04312.83
5.0.10.0130.02312.83
5.0.00.0200.02312.83
4.4.90.0100.02012.83
4.4.80.0070.03712.83
4.4.70.0130.03312.83
4.4.60.0130.01312.83
4.4.50.0130.01012.83
4.4.40.0100.04712.83
4.4.30.0100.03312.83
4.4.20.0070.02012.83
4.4.10.0100.02312.83
4.4.00.0130.02312.83
4.3.110.0170.01712.83
4.3.100.0130.01012.83
4.3.90.0100.01312.83
4.3.80.0200.02312.83
4.3.70.0100.01312.83
4.3.60.0100.03312.83
4.3.50.0100.03312.83
4.3.40.0170.04012.83
4.3.30.0100.03012.83
4.3.20.0100.01312.83
4.3.10.0030.03312.83
4.3.00.0030.02712.83

preferences:
36.22 ms | 401 KiB | 5 Q