3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDigit($Nth){ if($Nth < 10) return $Nth; $no_of_digits = 1; $current_contribution = 9; $actual_length = 9; $prev_length = 0; $starting_number = 1; $power_of_10 = 1; while($actual_length < $Nth){ $no_of_digits++; $current_contribution *= 10; $prev_length = $actual_length; $actual_length += ($current_contribution * $no_of_digits); $power_of_10 *= 10; $starting_number *= 10; } $Nth = $Nth - $prev_length; $offset = $Nth % $no_of_digits === 0 ? intval($Nth / $no_of_digits) - 1 : intval($Nth / $no_of_digits); $number = strval($starting_number + $offset); for($i=1;$i<=$no_of_digits;++$i){ if(($Nth - $i) % $no_of_digits === 0){ return $number[$i-1]; } } } for($i=1;$i<=100;++$i){ echo getDigit($i),PHP_EOL; }

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.5.30.0030.00418.94
8.5.20.0100.00719.52
8.5.10.0100.00818.25
8.5.00.0170.00720.09
8.4.180.0150.00819.60
8.4.170.0150.00724.04
8.4.160.0110.01122.98
8.4.150.0050.00716.85
8.4.140.0160.00617.52
8.4.130.0110.00917.82
8.4.120.0140.00622.36
8.4.110.0120.00922.55
8.4.100.0140.00817.51
8.4.90.0050.00520.52
8.4.80.0100.00218.90
8.4.70.0040.00420.52
8.4.60.0100.01018.64
8.4.50.0070.00918.70
8.4.40.0060.00319.23
8.4.30.0040.00420.55
8.4.20.0170.00318.91
8.4.10.0060.01017.93
8.3.300.0110.00919.36
8.3.290.0060.00620.93
8.3.280.0140.00918.43
8.3.270.0120.00916.40
8.3.260.0110.00816.70
8.3.250.0140.00620.98
8.3.240.0170.00316.77
8.3.230.0100.00816.55
8.3.220.0080.01118.91
8.3.210.0120.00718.56
8.3.200.0060.00316.56
8.3.190.0090.01017.43
8.3.180.0060.00518.90
8.3.170.0140.00716.46
8.3.160.0070.01117.25
8.3.150.0070.01018.88
8.3.140.0110.00720.91
8.3.130.0040.00418.39
8.3.120.0030.00618.86
8.3.110.0040.01120.94
8.3.100.0060.00316.73
8.3.90.0040.01518.45
8.3.80.0030.00617.97
8.3.70.0070.01118.29
8.3.60.0120.00918.56
8.3.50.0090.00921.19
8.3.40.0080.00818.82
8.3.30.0040.01118.52
8.3.20.0050.00321.90
8.3.10.0000.00722.09
8.3.00.0040.00422.34
8.2.300.0140.00818.10
8.2.290.0130.00716.70
8.2.280.0030.00518.43
8.2.270.0110.00722.14
8.2.260.0100.01016.76
8.2.250.0070.00718.25
8.2.240.0150.00417.32
8.2.230.0060.00322.58
8.2.220.0120.00824.06
8.2.210.0040.01126.77
8.2.200.0090.00018.20
8.2.190.0120.00918.29
8.2.180.0000.01518.29
8.2.170.0140.00022.96
8.2.160.0060.00922.13
8.2.150.0060.00324.18
8.2.140.0060.00324.66
8.2.130.0030.00526.16
8.2.120.0050.00319.95
8.2.110.0100.00021.04
8.2.100.0090.00317.78
8.2.90.0050.00317.62
8.2.80.0030.00517.97
8.2.70.0050.00318.16
8.2.60.0080.00018.15
8.2.50.0070.00418.10
8.2.40.0080.00019.15
8.2.30.0000.00819.25
8.2.20.0000.00818.17
8.2.10.0000.00819.39
8.2.00.0030.00519.19
8.1.340.0110.00917.45
8.1.330.0110.00821.78
8.1.320.0110.01016.04
8.1.310.0150.00416.67
8.1.300.0030.00619.76
8.1.290.0130.00018.88
8.1.280.0000.01525.92
8.1.270.0000.00820.82
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0040.00719.27
8.1.230.0060.00619.08
8.1.220.0080.00017.74
8.1.210.0060.00318.77
8.1.200.0060.00317.13
8.1.190.0040.00417.10
8.1.180.0050.00518.10
8.1.170.0000.00918.37
8.1.160.0050.00518.75
8.1.150.0050.00218.84
8.1.140.0040.00420.86
8.1.130.0060.00317.30
8.1.120.0070.00017.46
8.1.110.0030.00517.37
8.1.100.0000.00717.36
8.1.90.0040.00417.46
8.1.80.0000.00717.46
8.1.70.0040.00817.50
8.1.60.0000.00817.50
8.1.50.0050.00317.57
8.1.40.0080.00017.57
8.1.30.0030.00517.55
8.1.20.0000.00817.54
8.1.10.0030.00617.60
8.1.00.0060.00617.52
8.0.300.0030.00721.55
8.0.290.0000.00816.75
8.0.280.0000.00718.36
8.0.270.0050.00316.70
8.0.260.0070.00016.84
8.0.250.0040.00416.85
8.0.240.0000.00716.98
8.0.230.0050.00216.96
8.0.220.0050.00216.90
8.0.210.0070.00016.81
8.0.200.0000.00716.93
8.0.190.0070.00016.92
8.0.180.0040.00416.82
8.0.170.0030.00616.91
8.0.160.0000.00716.87
8.0.150.0070.00016.89
8.0.140.0030.00516.83
8.0.130.0030.00313.33
8.0.120.0040.00416.85
8.0.110.0040.00416.87
8.0.100.0070.00016.80
8.0.90.0070.00016.93
8.0.80.0080.00716.95
8.0.70.0040.00416.72
8.0.60.0000.00716.96
8.0.50.0000.00716.77
8.0.30.0100.01016.80
8.0.20.0140.00517.20
8.0.10.0040.00416.96
8.0.00.0070.01216.83
7.4.330.0040.00015.55
7.4.320.0040.00416.63
7.4.300.0030.00316.51
7.4.290.0040.00416.48
7.4.280.0060.00316.63
7.4.270.0040.00416.46
7.4.260.0060.00013.29
7.4.250.0050.00216.49
7.4.240.0020.00516.53
7.4.230.0040.00416.61
7.4.220.0020.00616.62
7.4.210.0070.00716.63
7.4.200.0070.00016.42
7.4.130.0180.00316.53
7.4.120.0060.01216.66
7.4.110.0120.00916.48
7.4.100.0100.01016.47
7.4.90.0070.01016.54
7.4.80.0150.00319.39
7.4.70.0080.01116.43
7.4.60.0130.00416.74
7.4.50.0070.01116.63
7.4.40.0070.01116.52
7.4.00.0090.00614.80
7.3.330.0060.00616.33
7.3.320.0000.00613.39
7.3.310.0050.00316.23
7.3.300.0070.00016.32
7.3.290.0030.00316.37
7.3.280.0130.00316.33
7.3.260.0090.01116.46
7.3.240.0090.01116.37
7.3.230.0040.01316.59
7.3.210.0170.00016.39
7.3.200.0100.00716.68
7.3.190.0090.01216.37
7.3.180.0090.00916.49
7.3.170.0090.00916.47
7.3.160.0060.01116.37
7.3.80.0100.00315.05
7.3.70.0070.00714.66
7.3.60.0100.01014.61
7.3.50.0000.01314.70
7.3.40.0000.01414.59
7.3.30.0090.00614.68
7.3.20.0090.00914.82
7.3.10.0100.01014.68
7.3.00.0100.00714.95
7.2.330.0100.01016.49
7.2.320.0130.01316.86
7.2.310.0120.00916.71
7.2.300.0120.01216.64
7.2.290.0070.01116.49
7.2.210.0110.00315.31
7.2.200.0150.00015.11
7.2.190.0060.01015.04
7.2.180.0040.01815.00
7.2.170.0110.00315.16
7.2.160.0030.01215.12
7.2.150.0100.01015.07
7.2.140.0150.00415.20
7.2.130.0430.01314.76
7.2.120.0210.00315.11
7.2.110.0120.01215.17
7.2.100.0090.01115.05
7.2.90.0160.00414.99
7.2.80.0060.01315.18
7.2.70.0100.01014.92
7.2.60.0130.01015.14
7.2.50.0130.00814.94
7.2.40.0130.01015.10
7.2.30.0190.00414.95
7.2.20.0260.00615.05
7.2.10.0190.01015.04
7.2.00.0120.00915.08
7.1.310.0160.00413.89
7.1.300.0130.00613.93
7.1.290.0130.00613.59
7.1.280.0180.00013.94
7.1.270.0080.01113.77
7.1.260.0150.00713.59
7.1.250.0060.01314.02

preferences:
45.59 ms | 1497 KiB | 5 Q