array_flip: Exchanges all keys with their associated values in an array : Array Function « Data Structure « PHP
- PHP
- Data Structure
- Array Function
array_flip: Exchanges all keys with their associated values in an array
<?php
$state = array("Delaware","Pennsylvania","New Jersey");
$state = array_flip($state);
print_r($state);
// Array ( [Delaware] => 0 [Pennsylvania] => 1 [New Jersey] => 2 )
?>
Related examples in the same category