$my_array = array( 'one 1' => '1', 'two 2' => '2' ); $keys = str_replace( ' ', '', array_keys( $my_array ) ); $results = array_combine( $keys, array_values( $my_array ) );