Zend
200-550 · Question #166
Which of the following expressions will evaluate to a random value from an array below? $array = array("Sue","Mary","John","Anna");
The correct answer is D. $array[array_rand($array)]. See the full explanation below for the reasoning.
Question
Which of the following expressions will evaluate to a random value from an array below? $array = array("Sue","Mary","John","Anna");
Options
- Aarray_rand($array);
- Barray_rand($array, 1);
- Cshuffle($array);
- D$array[array_rand($array)];
- Earray_values($array, ARRAY_RANDOM);
How the community answered
(39 responses)- A3% (1)
- B10% (4)
- D82% (32)
- E5% (2)
Community Discussion
No community discussion yet for this question.