This time for you to bring PHP to generate random numbers, letters or alphanumeric mixed strings, PHP to generate random numbers, letters or alphanumeric mixed string of considerations, the following is the actual case, together to see.
PHP generates random strings that can be specified as pure or plain letters or mixed.
example, you can specify a random string of length.
<?php//generates a random string function Rand_zifu ($what, $number) {$string = '; for ($i = 1; $i <= $number; $i + +) {//mixed $panduan =1; what = = 3) {if (==1) {$what = 1;} else{$what =2;} $panduan = 2; }//number if ($what ==1) {$string. =rand (0,9);} ElseIf ($what ==2) {//Letters $rand =rand (0,24); $b = ' a '; for ($a =0; $a <= $rand; $a + +) {$b + +;} $string. = $b;} if ($panduan ==2) $WH at=3; } return $string; } Echo Rand_zifu (3,10);
Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!
Recommended reading:
PHP cropping without affecting the shape of the image
PHP picture clipping and thumbnail use examples to explain