- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
array_flip() function in PHP
The array_flip() function exchanges all keys with their associated values in an array. It returns flipped array on success, else NULL on failure.
Syntax
array_flip(arr)
Parameters
arr − Specify the array of key/value pairs to be flipped.
Return
The array_flip() function returns flipped array on success, else NULL on failure.
Example
<?php $arr = array("p"=>"keyboard","q"=>"mouse","r"=>"monitor"); $res = array_flip($arr); print_r($res); ?>
Output
Array ( [keyboard] => p [mouse] => q [monitor] => r )
Advertisements