如何交换键与数组值? [英] How to swap keys with values in array?
本文介绍了如何交换键与数组值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有喜欢的数组:
array(
0 => 'a',
1 => 'b',
2 => 'c'
);
我需要将其转换为:
I need to convert it to:
array(
'a',
'b',
'c'
);
什么是交换键和值的最快方法?
What's the fastest way to swap keys with values?
推荐答案
php have array_flip function , but in your case
您不需要它了同样的事情。
you do not need it its the same thing
array(
'a',
'b',
'c'
);
此阵有像0,1,2键
this array have keys like 0,1,2
这篇关于如何交换键与数组值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文