mercredi 30 août 2017

What is the PHP function to return a random value from an associative array?

I thought it was that simple as I used array_rand trying to get a random value from the following array:

$array= Array ( [0] => 126 [1] => 74 );
array_rand($array);

But it is returning 0, what tells me, this is not the right function in this case.




Aucun commentaire:

Enregistrer un commentaire