Showing posts with label rand. Show all posts
Showing posts with label rand. Show all posts

Saturday 28 June 2014

How to get n digit random numers in php?

function generate_number_code( $length = 8 ) {
  $chars = "0123456789";
  $password = substr( str_shuffle( $chars ), 0, $length );
  return $password;
 }