One or more units are randomly selected from the array. Array_rand () is used to randomly extract one or more units from an array. it is useful to retrieve one or more random units from an array. It uses input as the input number to randomly extract one or more units from the array. we will use array_rand (), it is useful to retrieve one or more random units from an array. It accepts input as an input array and an optional parameter num_req, specifying the number of units you want to retrieve-if not specified, the default value is 1. If you only retrieve one, array_rand () returns the key name of a random unit. Otherwise, an array containing the random key name is returned.
$ A = array ("a" => "dog", "B" => "cat", "c" => "horse ");
Print_r (array_rand ($ a, 1 ));
?>
Random () is useful when you want to extract one or more random units from an array. It accepts input as the input number...