Which of the following expressions will evaluate to a random value from an array below?

Posted by: Pdfprep Category: 200-710 Tags: , ,

Which of the following expressions will evaluate to a random value from an array below?

$array= array("Sue","Mary","John","Anna");
A . array_rand($array);
B . array_rand($array, 1);
C . shuffle($array);
D . $array[array_rand($array)];
E . array_values($array, ARRAY_RANDOM);

Answer: D

Leave a Reply

Your email address will not be published.