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; }
Output for git.master, git.master_jit, rfc.property-hooks
1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 3 0 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 4 0 4 1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 4 9 5 0 5 1 5 2 5 3 5 4 5

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
116 ms | 1497 KiB | 4 Q