Re: random within random array?
| From: | Marek Kilimajer | Date: | Mon, 21 Apr 2003 19:07:13 +0000 |
| Subject: | Re: random within random array? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144696@lists.php.net to get a copy of this message | ||
Sorry, my mistake, the line should read
$parts[]=$first[array_rand($first)]. $second[array_rand($second)].$third[array_rand($third)];
Bryan Koschmann - GKT wrote:
Marek, Thank you for your reply! I hope I am not further bothering you, however I only seem to get numbers with this, I'm guessing the position in the array? They are random though. Any way to change this, or do I need to do some more research? Thanks again for your time! Bryan On Mon, 21 Apr 2003, Marek Kilimajer wrote: |Create 3 arrays: |$first=array('a','b','c','d','e','f','g'); |$second=array('es','is',''); |$third=array('',"'","''","'''"); // single quotes within double | |repeat this as many times as neccessery: |$parts[]=array_rand($first). array_rand($second).array_rand($third); | |create the whole string with spaces separating parts: |$whole=implode(' ',$parts); | |> |>the first set will be random characters from this group: