转换关联数组进入正常的人 [英] Converting associative arrays into normal ones

查看:142
本文介绍了转换关联数组进入正常的人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关联数组,看起来是这样的:

I have an associate array that looks something like this:

array
(
   'device_1' => array('a','b','c','d'),
   'device_2' => array('x','y','z')
)

我怎么可以在阵列内爆成这样的标准数组:

How can I implode the array into a standard array like this:

array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd', 4 => 'x', 5 => 'y', 6 => 'z')

或者更简单地说:

Or more simply:

array('a','b','c','d','e','x','y','z')

有谁知道我应该怎么办呢?

Does anybody know what I should do?

推荐答案

您可以这样做:

$result = call_user_func_array('array_merge', $array);

这将给你:

Array
(
    [0] => a
    [1] => b
    [2] => c
    [3] => d
    [4] => x
    [5] => y
    [6] => z
)

演示

这篇关于转换关联数组进入正常的人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆