Function to exchanges keys with their associated values in an array – PHP

<?php
 $testArray = array("key1" => "Value1","key2" => "Value2","key3" => "Value3");
 $testArray = array_flip($testArray);
 print_r($testArray);
 //Array ( [Value1] => key1 [Value2] => key2 [Value3] => key3 )
?>

Leave a Reply

Your email address will not be published. Required fields are marked *