array_rand Tutorials

array_rand

Syntax: mixed array_rand ( array $input [, int $num_req = 1 ] ) Description: Pick one or more random entries out of an array <?php $input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank"); $rand_keys = array_rand($input, 2); echo $input[$rand_keys[0]] . "<br/>"; echo $input[$rand_keys[1]]; ?> OUTPUT Neo Trinity... Read More »