The array_flip function returns flips all of the keys and their values in associative array.

    
    $capitals = array('New York' => 'Albany', 'Texas' => 'Austin', 'Florida' => 'Tallahassee');

    $capitalsFlipped = array_flip($capitals);

    print_r($capitalsFlipped);
    // Array
    // (
    //  [Albany] => New York
    //  [Austin] => Texas
    //  [Tallahassee] => Florida
    // )