array_flip( ) exchanges all the keys in that array with their matching values : array_flip « Data Structure « PHP
- PHP
- Data Structure
- array_flip
array_flip( ) exchanges all the keys in that array with their matching values
<?
$capitalcities['England'] = 'London';
$capitalcities['Scotland'] = 'Edinburgh';
$capitalcities['Wales'] = 'Cardiff';
$flippedcities = array_flip($capitalcities);
var_dump($flippedcities);
?>
Related examples in the same category