PHP Splitting an Array into two arrays - keys array and values array

后端 未结 6 1444
夕颜
夕颜 2020-12-14 08:52

Is there an easy way to split an array into two arrays, one consisting of all the keys and the other consisting of all the values? This would be a reverse to the action of

6条回答
  •  猫巷女王i
    2020-12-14 09:57

    There are two functions called array_keys and array_values:

    $array_keys = array_keys($array);
    $array_values = array_values($array);
    

提交回复
热议问题