Array_flip
(PHP 4 and PHP 5)
Array_flip-array of organic codes and their related values of the exchange
Description
Array array_flip (array $ Cross)
Array_flip () returns the inverted order in an array, that is, the key is converted into the value concept and the value concept from the opposite to the key.
Note that values need to be valid keys, that is, they must be either integers or strings. Warning if the emission value has an incorrect type, the key/value pair issue will not be flipped.
If a value has several events, the newest key will be used as its own value, and all others will be lost.
Parameters
Reverse
A series of key/value pairs are flipped.
Return value
Returns the array flip success and FALSE failure.
Instance
Example #1 array_flip ()
<? Php
$ Trans = array_flip ($ trans );
$ Original = strtr ($ str, $ trans );
?>
Example #2 array_flip () example: collision
<? Php
$ Trans = array ("a" => 1, "B" => 1, "c" => 2 );
$ Trans = array_flip ($ trans );
Print_r ($ trans );
?>