$state = array("Delaware","Pennsylvania","New Jersey"); $state = array_flip($state); print_r($state); // Array ( [Delaware] => 0 [Pennsylvania] => 1 [New Jersey] => 2 )?>