PHP generates a function to share a random string with a custom length. Php randomly generated strings can be customized to define their own length, which is often encountered in practical application development. The code for copying the code is as follows: generate a random string functionrandom ($ php randomly generate a string to define its own length, which is often encountered in practical application development.
The code is as follows:
// Randomly generate a string
Function random ($ length ){
Srand (date ("s "));
$ Possible_charactors = "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ ";
$ String = "";
While (strlen ($ string) <$ length ){
$ String. = substr ($ possible_charactors, (rand () % (strlen ($ possible_charactors), 1 );
}
Return ($ string );
}
Bytes. The code is as follows: // randomly generate the function random string ($...