PHP random arrays Turn Back
2016-09-09 17:00:27
PHP Script for random one of array key
<?PHP
$text = array();
$text[] = 'Content 1';
$text[] = 'Content 2';
$text[] = 'Content 3';echo $text[ array_rand($text,1) ];
?>
If you want more than one
<?PHP
$keys = array_rand($text, 2);
echo $text[ $keys[0] ];
echo $text[ $keys[1] ];?>