PHP Programing language

array_flip() Functions in PHP
Previous Home Next

array_flip()

The array_flip() function flips/exchanges all keys with their associated values in an array.

Syntax:
array_flip(array);

In above syntax,"array" specifies an array of key/value pairs to be flipped.

Example:

<?php
$array1=array("a"=>"Apple","b"=>"Banana","c"=>"Orange","d"=>"Mango");
$result=array_flip($array1);
print_r($result);
?>

Output:

Array ( [Apple] => a [Banana] => b [Orange] => c [Mango] => d )

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: