At 21:17 8/5/2001, Jeroen van Wolffelaar wrote the following:
-------------------------------------------------------------- 

[...]

>> 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";
>> }
>
>I find rand_str($len , "1..9a..f\x4F") easier... ;-)
>And this is still yielding exactly 16 differerent characters.
>
>As you saw for yourself, it is not trivial to implement something like this
>in userland. For example str_pad is way easier to implement, only some
>playing with str_repeat.
>
>Are there any objections if I implement this? Are you still against this new
>function?
>
>Jeroen

Hi Jeroen,

I think we're not on the same page. :) I consider both versions
of str_rand() I posted trivial... 
Also, and this is strictly subjective, I don't think the function 
needs to be implemented natively. As I said, it's trivial. :) But 
my stance could be rated as -0.3... Actually, as I'm thinking about 
it, -0.2.

as for the rand_str($len , "1..9a..f\x4F") proto: 
I don't like it. KISS.




[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