array_rand: Pick one or more random entries out of an array
<?php $states = array("Ohio" => "Columbus", "Iowa" => "Des Moines","Arizona" => "Phoenix"); $randomStates = array_rand($states, 2); print_r($randomStates); ?>