Array Flip function in PHP

In this article I explain array flip function in PHP.
  • 1760

PHP array_flip Function

The array _flip function is used to exchange all keys with their associated values in an array.

Syntax

array_flip (array)

Parameter

The parameter for the array_flip function is:

Parameter Description
array It specifies an array.

Example

An example of the array_flip function is:

<?php

echo"<pre>";

$val=array("a" => "Apple", "b" => "Mango", "c" => "Orange", "Banana");

$exchange = array_flip($val);

print_r($exchange);

?>

Output

array-flip-function-in-php.jpg

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.