php4-beta | 200004
Date: 04/29/00
- Next message: php4 <email protected>: "Re: [PHP4BETA] array_rand() feedback"
- Previous message: Andrei Zmievski: "Re: [PHP4BETA] array_rand() feedback"
- In reply to: Andrei Zmievski: "Re: [PHP4BETA] array_rand() feedback"
- Next in thread: php4 <email protected>: "Re: [PHP4BETA] array_rand() feedback"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Andrei,
re your key/val suggestion: it can be certainly done with
echo arr[$key] ; but if it can be done faster (I mean the
execution time, though it's certainly [very small] saving
in the code as well) by your function, you should do it.
At 16:20 29.4.2000 -0500, Andrei Zmievski wrote the following:
--------------------------------------------------------------
>On Sat, 29 Apr 2000, Sterling Hughes wrote:
> > I think it would be a good idea to just return keys, not key-value
> > pairs, since its simple enough to do:
> >
> > $key = array_rand($ar);
> > echo $ar[$key]; // value (duh)
> >
> > I also like the second argument idea, again I think it should be
> > something like:
> >
> > list ($key1, $key2, $key3) = array_rand($ar, 3);
>
>Good idea, I'll implement it.
>
>-Andrei
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic <email protected>
ICQ: 2808 2505
-- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe <email protected> For additional commands, e-mail: php4beta-help <email protected> To contact the list administrators, e-mail: php4beta-admin <email protected>
- Next message: php4 <email protected>: "Re: [PHP4BETA] array_rand() feedback"
- Previous message: Andrei Zmievski: "Re: [PHP4BETA] array_rand() feedback"
- In reply to: Andrei Zmievski: "Re: [PHP4BETA] array_rand() feedback"
- Next in thread: php4 <email protected>: "Re: [PHP4BETA] array_rand() feedback"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

