Jump to content

echoing array index and getting a blank page


my8code

Recommended Posts

<?

$array = array('eggs', 'bacon', 'football', 'baseball', 'ford', 'toyota'); 

$rand_index = mt_rand(0, count($array) / 2 - 1) * 2; 
?>



<?php echo "$array[$rand_index]"; ?><?php echo "$array[$rand_index+1]"; ?>

 

i dunno why this doesn't work. I want to echo both values three of the pairs such as eggs bacon  or football baseball

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.