Create numerical-key array from existing string-key array, with a given string-key as first item
PHP has a function built in for this: array_values()

&lt;?php

$allLanguages = [
    'en' =&gt; ['locale' =&gt; 'en_US', 'code' =&gt; 'en', 'displayName' =&gt; 'English'],
    'sv' =&gt; ['locale' =&gt; 'sv_SE', 'code' =&gt; 'sv', 'displayName' =&gt; 'Swedish'],
    'de' =&gt; ['locale' =&gt; 'de_DE', 'code' =&gt; 'de', 'displayName' =&gt; 'German']
];

var_dump(array_values($allLanguages));


Outputs:

array(3) {
  [0]=&gt;
  array(3) {
    ["locale"]=&gt;
    string(5) "en_US"
    ["code"]=&gt;
    string(2) "en"
    ["displayName"]=&gt;
    string(7) "English"
  }
  [1]=&gt;
  array(3) {
    ["locale"]=&gt;
    string(5) "sv_SE"
    ["code"]=&gt;
    string(2) "sv"
    ["displayName"]=&gt;
    string(7) "Swedish"
  }
  [2]=&gt;
  array(3) {
    ["locale"]=&gt;
    string(5) "de_DE"
    ["code"]=&gt;
    string(2) "de"
    ["displayName"]=&gt;
    string(6) "German"
  }
}


Live Example



If you combine that function with this answer, you can move the desired array element to the top of the array before removing the keys:

&lt;?php

$allLanguages = [
    'en' =&gt; ['locale' =&gt; 'en_US', 'code' =&gt; 'en', 'displayName' =&gt; 'English'],
    'sv' =&gt; ['locale' =&gt; 'sv_SE', 'code' =&gt; 'sv', 'displayName' =&gt; 'Swedish'],
    'de' =&gt; ['locale' =&gt; 'de_DE', 'code' =&gt; 'de', 'displayName' =&gt; 'German']
];

$currentLanguage = 'sv';

// Move the desired language to the front of the array
$allLanguages = [$currentLanguage =&gt; $allLanguages[$currentLanguage]] + $allLanguages;

// Get a new array with just the values
$allLanguages = array_values($allLanguages);

var_dump($allLanguages);


Live Example



As a one liner:

&lt;?php

$allLanguages = array_values([$currentLanguage =&gt; $allLanguages[$currentLanguage]] + $allLanguages);


Live Example



As a helper function:

&lt;?php

function processLanguages($current, $languages) {
    return array_values([$current =&gt; $languages[$current]] + $languages);
}

$allLanguages = [
    'en' =&gt; ['locale' =&gt; 'en_US', 'code' =&gt; 'en', 'displayName' =&gt; 'English'],
    'sv' =&gt; ['locale' =&gt; 'sv_SE', 'code' =&gt; 'sv', 'displayName' =&gt; 'Swedish'],
    'de' =&gt; ['locale' =&gt; 'de_DE', 'code' =&gt; 'de', 'displayName' =&gt; 'German']
];

var_dump(processLanguages('sv', $allLanguages));


Live Example