PHP Array Flip – Array Value Key Flip

PHP example that you can use to flip the values and keys in an array. Essentially all the values will become keys and all the keys will become values.

<php

$sampleArray = array(0=>”one”, 1=>”two”, 2=>”three”);

$flipedArray = array_flip($sampleArray);

endphp>

Bookmark and Share

Comments are closed.