PHP

PHP Menu

PHP

array_flip() Function - Definition, Syntax, Parameters, Examples

Definition

The array_flip() function flip or exchanges all keys with their associated values in an array, i.e. keys from the array become values and the values from the array become keys.

Syntax

array_flip(array)

Parameters

Parameter Description
array Required. Specifies an array of key/value pairs to be flipped.

Example

<?php
$ages = array("Mark" => 22, "Jeff" => 32, "Mike" => 28);
$result=array_flip($ages); print_r($result);

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods