Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

array_rand()

$
0
0

as we know array_rand outputs the keys,, how to get value from it of the random element

 

i tried this:-

 

<?php

$n = array("lions", "tigers", "bears", "kittens");

 

var_dump(array_rand($n));

 

?>

and also how to get values, if  i pass the 2nd parameter i.e. number of random keys we need,, because the array returned by it contain keys as their values


Viewing all articles
Browse latest Browse all 13200

Trending Articles