array_flip

It exchanges all keys with their associated values in an array

Example

<?php
echo “<pre>”;
$array1 = array(“ASP” => WEB, “PHP” => WEB, “JSP” => SEREVR);
$array2 = array_flip($array1);
print_r($array2);
?>

Output

AArray
(
[WEB] => PHP
[SEREVR] => JSP
)

Share