PHP array_flip() Function

The array_flip() is an inbuilt function of PHP and is used to exchanges all keys with their associated values in an array. array_flip() returns an array in flip order, i.e. keys from array become values and values from array become keys.

array_flip() function returns the flipped array on success and NULL on failure.


array: An array of key/value pairs to be flipped.

Example #1 array_flip() example


Example #2 array_flip() example

Example #3 array_flip() example



If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts: