Array Flip function in PHP
In this article I explain array flip function in PHP.
PHP array_flip Function
The array _flip function is used to exchange all keys with their associated values in an array.
Syntax
Parameter
The parameter for the array_flip function is:
Parameter |
Description |
array |
It specifies an array. |
Example
An example of the array_flip function is:
<?php
echo"<pre>";
$val=array("a" => "Apple", "b" => "Mango", "c" => "Orange", "Banana");
$exchange = array_flip($val);
print_r($exchange);
?>
Output
