Php obtains a specified number of random strings. php obtains the number of strings.
This example describes how php can obtain a specified number of random strings. We will share this with you for your reference. The details are as follows:
Function getARandLetter ($ number = 1) {if ($ number = 0) return FALSE; // remove 0 $ number = $ number <0? -$ Number: $ number; // if the value is less than zero, take the positive value $ letterArr = array ('A', 'B', 'C', 'D', 'E ', 'F', 'G', 'h', 'I', 'J', 'k', 'l', 'M', 'n', 'O ', 'P', 'Q', 'R','s ', 't', 'U', 'V', 'w', 'x', 'y ', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'h', 'I ', 'J', 'k', 'l', 'M', 'n', 'O', 'P', 'Q', 'R','s ', 'T', 'U', 'V', 'w', 'x', 'y', 'z'); $ returnStr = ''; for ($ I = 0; $ I <$ number; $ I ++) {$ returnStr. = $ letterArr [rand (0, 51)];} return $ returnStr;} echo getARandLetter (8 );
Running result: lUJfScvS
PS: here we will provide you with an online tool with similar functions for your reference:
High-strength Password generator:
Http://tools.jb51.net/password/CreateStrongPassword