note 77343 added to function.array-rand
| From: | bharan_n at yahoo dot co dot in | Date: | Sat, 25 Aug 2007 00:00:45 +0000 |
| Subject: | note 77343 added to function.array-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129775@lists.php.net to get a copy of this message | ||
I am new to this php. I only edit the codes according to my requirement.I displayed a random list of
words in two sets with 15 in each set.
Below is the code for that.
<?php
srand((float) microtime() * 10000000);
$input = array(
'Art Of Betrayal', 'California Or Bust', 'Flood Gate','Bomb
Shell','Dark Town','Kylies Smiley','song1',
'song50', 'song1', 'song57', 'Dark Town',
'song47', 'song61', 'song56', 'Kylies Smiley',
'song22','song50', 'song1', 'song57', 'Dark Town',
'song47', 'song61', 'song56', 'Kylies
Smiley','song50', 'song1', 'Dark Town', 'song57',
'song54', 'song47', 'song61', 'song56', 'song49',
'Kylies Smiley', 'song53', 'song58');
?>
<table border="1" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber3">
<tr>
<td width="50%" align="center">SET1</td>
<td width="50%" align="center">SET2</td>
</tr>
<?php
for ($i = 0; $i<sizeof($input);$i++)
{
$rand_keys = array_rand($input,5);
if ($i!=30)
{
?>
<tr>
<td width="50%" align="center">
<?php echo $input[$rand_keys[0]] . "\n <br />" ;?></td>
<td width="50%" align="center">
<?php echo $input[$rand_keys[1]] . "\n <br />" ;?> </td></tr>
<?php
}
else
{?>
</table>
<?php break;
}
}
?>
----
Server IP: 203.199.124.111
Probable Submitter: 59.93.55.23
----
Manual Page -- http://www.php.net/manual/en/function.array-rand.php
Edit -- https://master.php.net/note/edit/77343
Del: integrated -- https://master.php.net/note/delete/77343/integrated
Del: useless -- https://master.php.net/note/delete/77343/useless
Del: bad code -- https://master.php.net/note/delete/77343/bad+code
Del: spam -- https://master.php.net/note/delete/77343/spam
Del: non-english -- https://master.php.net/note/delete/77343/non-english
Del: in docs -- https://master.php.net/note/delete/77343/in+docs
Del: other reasons-- https://master.php.net/note/delete/77343
Reject -- https://master.php.net/note/reject/77343
Search -- https://master.php.net/manage/user-notes.php