-
From: "Cynic" <[EMAIL PROTECTED]>
To: "Jeroen van Wolffelaar" <[EMAIL PROTECTED]>
Cc: "PHP Developers Mailing List" <[EMAIL PROTECTED]>
Sent: Sunday, August 05, 2001 5:16 PM
Subject: Re: [PHP-DEV] Re: rand_str
> At 22:50 8/5/2001, Jeroen van W
At 22:50 8/5/2001, Jeroen van Wolffelaar wrote the following:
--
>> >Implementing something that has NOT that limitation, is far less trivial.
>>
>> function str_rand($len = 8, $class = 'a-zA-Z1-9')
>> {
>> static $init = 1;
>> i
> >Implementing something that has NOT that limitation, is far less trivial.
>
> function str_rand($len = 8, $class = 'a-zA-Z1-9')
> {
> static $init = 1;
> if(1 == $init){
> mt_srand((double) microtime() * 100);
> $init = 0;
> }
> $chars = array();
> for($i
At 21:53 8/5/2001, Jeroen van Wolffelaar wrote the following:
--
>> Hi Jeroen,
>>
>> I think we're not on the same page. :) I consider both versions
>> of str_rand() I posted trivial...
>
>Agree. But they are not what rand_str could do.
> Hi Jeroen,
>
> I think we're not on the same page. :) I consider both versions
> of str_rand() I posted trivial...
Agree. But they are not what rand_str could do. The result has
16 different chars, just because md5 happens to have that much.
Implementing something that has NOT that limitation,
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;
> >> 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(),
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.
>
>>
>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
heh.. possibly. ;)
forwarded.
/ d
- Original Message -
From: "Cynic" <[EMAIL PROTECTED]>
To: "Daniel Andersson" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, August 05, 2001 15:59
Subject: Re: [PHP-DEV] Re: rand_str
> I'm not a
e the following:
--
>yes, totally agree.
>
>but why not put it into PEAR?
>
>/ d
>
>- Original Message -
>From: "Cynic" <[EMAIL PROTECTED]>
>To: "Daniel Andersson" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
&g
yes, totally agree.
but why not put it into PEAR?
/ d
- Original Message -
From: "Cynic" <[EMAIL PROTECTED]>
To: "Daniel Andersson" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, August 05, 2001 13:52
Subject: Re: [PHP-DEV] Re: rand_str
y done, yes. but still..
>
>maybe something for PEAR instead of the core?
>
>/ d
>
>
>- Original Message -
>From: "Cynic" <[EMAIL PROTECTED]>
>To: "Daniel Andersson" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>Sent: Sunday,
el Andersson" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, August 05, 2001 3:41
Subject: Re: [PHP-DEV] Re: rand_str
> is it that much more useful than md5(microtime()) ?
> ah-oh, you want to be able to specify the set of characters...
>
> At 04
is it that much more useful than md5(microtime()) ?
ah-oh, you want to be able to specify the set of characters...
At 04:28 8/5/2001, Daniel Andersson wrote the following:
--
>sounds useful and cool, me thinks :o)
>
>/ d
>
><[EMAIL PROT
15 matches
Mail list logo