Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: user6d450
Added: May 16, 2019 12:25 PM
Views: 13
Tags: no tags
  1. function random_strings($length_of_string)
  2. {
  3.  
  4.     // String of all alphanumeric character
  5.     $str_result = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
  6.  
  7.     // Shufle the $str_result and returns substring
  8.     // of specified length
  9.     return substr(str_shuffle($str_result),  
  10.                        0, $length_of_string);
  11. }
  12.  
  13. function random19() {
  14.   $number = "";
  15.   for($i=0; $i<19; $i++) {
  16.     $min = ($i == 0) ? 1:0;
  17.     $number .= mt_rand($min,9);
  18.   }
  19.   return $number;
  20. }