Questions

How to create a random string in php

Random String Generation :-
              Function random_gen() is used to generate random string with ten characters

Random String

function random_gen($length){
        $string='ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789';
        $max=strlen($string)-1;
        $activatecode='';
        mt_srand((double)microtime()*1000000);
        while (strlen($activatecode)<$length+1)
            $activatecode.=$string{mt_rand(0,$max)};
        return $activatecode;
    }

Your Answers

Your Name:
Your Answers :
<> is a code tag
Preview
Enter the verification code:

Answers

No Answers..