PHP array_flip() Function
Complete PHP Array Reference
Definition and Usage
The array_flip() function returns an array with all the original keys as values, and all original values as keys.
Syntax
| Parameter |
Description |
| array |
Required. Specifies an array |
Example
<?php
$a=array(0=>"Dog",1=>"Cat",2=>"Horse");
print_r(array_flip($a));
?>
|
The output of the code above will be:
|
Array ( [Dog] => 0 [Cat] => 1 [Horse] => 2 )
|
Complete PHP Array Reference

The Altova MissionKit is an integrated suite of tools ideal for:
- XML development
- Web & Web services development
- Data mapping & integration
- Rendering & publishing XML & database data
- XBRL validation, taxonomy editing, transformation & rendering
The MissionKit for XML Developers includes XMLSpy® - the industry-leading XML editor; MapForce® - a
graphical data mapping, conversion, and integration tool; StyleVision® - a visual XSLT stylesheet designer;
DiffDog® - an XML-aware diff/merge tool; and 2 additional tools.
Try all 6 products free for 30 days!
Download a fully-functional free trial
|
|
|
|