> >> 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";
> }

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


-- 
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