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 :
array_flip()
function is given with:
array_flip(array);
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.
Output :
Array
(
[Web] => a
[designing] => b
[house] => c
)