PHP array_flip() Function

PHP array_flip Function


Description :
The array_flip() function flip or exchanges all keys with their associated values in an array, i.e. keys from the array become values and the values from the array become keys. 

 Syntax :

The basic syntax of the array_flip() function is given with:
       array_flip(array);
 
Parameters :
The array_flip() function accepts the following parameter.
Parameter
Description
array
Required. Specifies an array of key/value pairs to be flipped.
 

 The following example shows the array_flip() function in action.

Example :

Output :

Array
(
    [Web] => a
    [designing] => b
    [house] => c
)