At 17:21 8/5/2001, Jeroen van Wolffelaar wrote the following:
-------------------------------------------------------------- 
>>but why not put it into PEAR?
>PEAR can be useful, but the power of PHP is, that is has so many helpful
>build-in functions. And with pear, it will always be longer.
>
>> I think that new functions should be added on basis of
>> usefulness, not the "coolness" factor. IMNSHO this function
>> isn't very useful,
>
>To generate random passwords, with characters you decide, and length? I
>think it is useful, but usefulness indeed is a good point. Does everyone
>here doubt the usefulness?
>
>> and it is extremely easy to implement in
>> userland:
>
>That is not true, 

So how about this?

function str_rand($len=8)
{
    $retval = strtr(md5(microtime()), chr(0x30), chr(0x4F));
    return substr($retval,0,$len);
}

for($i=0; $i<10; $i++){
    echo str_rand(), "\n";
}

>md5 will always return hex, and is of specific length. I
>can image users don't want (so much) digits, and/or want to exclude certain
>look-alike chars ( 0 (zero) and O (o), for example).




[EMAIL PROTECTED]
-------------
And the eyes of them both were opened and they saw that their files
were world readable and writable, so they chmoded 600 their files.
    - Book of Installation chapt 3 sec 7 


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to