PHP将数组拆分为两个数组 - 键数组和值数组

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 array_combine. Is there an inbuilt function for doing such a task? Let's use an example array:

$array = array('Tiger' => 'Forest', 'Hippo' => 'River', 'Bird' => 'Sky');

Is there a function that will split the above array into:

$array_keys = array('Tiger', 'Hippo', 'Bird');
$array_values = array('Forest', 'River', 'Sky');
查看全部
doushi7314
doushi7314
2011/06/04 04:32
  • php
  • arrays
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

6个回复