Hello friends,
This time I am here to explain a very common issue in php which if is someone want to exchange the array keys with values, for this you can use a predefined php array function "array_flip ( array $array )". array_flip ( $array ) used for exchange the values with keys of the array.
Here is some example-
<?php
$input = array("oranges", "apples", "pears");
$flipped = array_flip($input);
print_r($flipped);
?>
Output:
Array
(
[oranges] => 0
[apples] => 1
[pears] => 2
)
0 Comment(s)