array_flip
array_flip
======
It flip all the values of an array.It returns an array in reverse order of a input array,
i.e. keys from input array become values of output array and keys from output array become values of input array.
Note that the values of input array need to be valid keys. i.e. they need to be either integer or string.
A warning will be emitted if a value has the wrong type, and the key/value pair in question will not be flipped.
If a value has several occurrences, the latest key will be used as its values, and all others will be lost.
It returns false if it fails.
Syntax:
=====
array array_flip ( array input)
Example 1:
=======
$input = array (”a” => 1, “b” => 2, “c” => 3);
$output = array_flip ($input);
print_r($output);
The Result of $output array is
Array
(
[1] => a
[2] => b
[3] => c
)
Example 2:
=======
$input = array (”a” => 1, “b” => 2, “c” => 2);
$output = array_flip ($input);
print_r($output);
The Result of $output array is
Array
(
[1] => a
[2] => c
)
