note 105996 deleted from function.count by danbrown
| From: | danbrown@php.net | Date: | Fri, 30 Sep 2011 21:24:11 +0000 |
| Subject: | note 105996 deleted from function.count by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183551@lists.php.net to get a copy of this message | ||
Note Submitter: winklerd at gmail dot com
----
gothamxi's example will never select the first element in the array and may occasionally select
an index not in the array. Should be:
<?php
$topic=array(
"UFOs",
"Barack Obama",
"China",
"Christianity",
"Communism",
"World War II",
"Global Warming",
"Vegetarianism",
);
echo ("What do you think about ".$topic[ rand( 1,count($topic)) - 1 ]."? ");
?>