|
|
exchanges all keys with their associated values in an array - PHP
|
Views : 275
|
|
Tagged in : PHP
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
If we want to exchanges all keys with their associated values in an array, we can make use of array_flip function
$trans = array("a" => 1, "b" => 1, "c" => 2);
$trans = array_flip($trans);
print_r($trans);
?>
Result
Array
(
[1] => b
[2] => c
)
Here keys are changed to values and array values are changed to array key |
|
By - kalai, On - 2009-11-07 |
|
|
|