-6

嗨朋友这是我的阵列:-

 [0] => Array
    (
        [0] => Array
            (
                [name] => rel
                [value] => 8th 
            )

        [1] => Array
            (
                [name] => imag
                [value] => media/fil
            )

        [2] => Array
            (
                [name] => dur
                [value] => 130
            )

        [id] => 1009
    )

我希望输出是这样的: -

    [0] => Array
    (
        [0] => Array
            (
                [name] => rel
                [value] => 8th
                [id] => 1009
            )

        [1] => Array
            (
                [name] => imag
                [value] => media/fil
                [id] => 1009
            )

        [2] => Array
            (
                [name] => dur
                [value] => 130
                [id] => 1009
             )

    )

谁能帮我吗 ??

我尝试了大多数数组函数,但它不起作用

4

1 回答 1

3
$id = $array['id'];
unset($array['id']);
foreach($array as $k=>$v) {
    $array[$k]['id'] = $id;
}
于 2013-03-25T05:41:15.290 回答