帮助PHP数组

时间:2011-07-01 19:21:27

标签: php arrays sorting

我的数组看起来像这样,

    Array
(
    [email_address] => Array
        (
            [0] => sadasdasd
            [1] => Simosdsad
        )

    [firstname] => Array
        (
            [0] => sadsadas
            [1] => simon
        )

    [surname] => Array
        (
            [0] => asdasdasdasdasd
            [1] => ainley
        )

    [companies_company_id] => 
    [save_user] => Save User
)

所有的键[0]是否相关,是否有自己的阵列?

1 个答案:

答案 0 :(得分:1)

这样做的简单方法是:

$newArray = array();
foreach($array as $key => $value)  {
    $newArray[] = $value[0];
}

你有没有理由?