In PHP it’s easy to work with arrays. Just declare someting like this:
<?php $arrX = array("Kay", "Joe","Susan", "Frank"); ?>
Now you can access the values with their index (which starts a 0 for the first item).
<?php // output "Kay" echo $arrX; // output "Susan" echo $arrX; ?>
PHP offers you several ways to get a random value of the array. One simple way is by using the
array_rand() expects the array as a parameter and returns a random index value as integer which then can be used to get the array value.