array_flip

PHP 4, PHP 5, PHP 7, PHP 8
array_flip - Exchanges all keys with their associated values in an array

Example #1 array_flip example

Result: Array ( [oranges] => 0 [apples] => 1 [pears] => 2 )
PHP Version:

Example #2 array_flip example : collision

Result: Array ( [1] => b [2] => c )
PHP Version:


Example #3 of array_flip

PHP Version: