From http://www.w3schools.com (Copyright Refsnes Data)
The array_flip() function returns an array with all the original keys as values, and all original values as keys.
array_flip(array) |
Parameter | Description |
---|---|
array | Required. Specifies an array |
<?php $a=array(0=>"Dog",1=>"Cat",2=>"Horse"); print_r(array_flip($a)); ?> |
The output of the code above will be:
Array ( [Dog] => 0 [Cat] => 1 [Horse] => 2 ) |
From http://www.w3schools.com (Copyright Refsnes Data)