Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Php Programming Code Examples

Php > Algorithms Code Examples

Random digit

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Random digit <?php function randomdigit($digits) { static $startseed = 0; if (!$startseed) { $startseed = (double)microtime()*getrandmax(); srand($startseed); } $range = 8; $start = 1; $i = 1; while ($i<$digits) { $range = $range . 9; $start = $start . 0; $i++; } return (rand()%$range+$start); } ?>