删除数组结果

时间:2011-02-18 05:05:01

标签: php arrays

[5] => Array
    (
        [id] => 29372
        [product_id] => Array
            (
                [0] => stdClass Object
                    (
                        [id] => 1469
                        [type_id] => 1
                        [title] => Hearth 2 Hearth
                        [cover] => 21cf9d7d09d403251ba5d01ff33cd089.jpg
                        [coverid] => 1178
                        [inserted_by] => 0
                        [inserted_date] => 2011-02-11 13:55:23
                        [status_id] => 0
                    )

            )

        [variable_id] => 9
        [variable_value] => 2011-02-11
        [master_value] => 
        [released_date] => 2011-02-11
        [price] => Array
            (
                [0] => Array
                    (
                        [product_id] => 1469
                        [media_format] => VCD
                        [price] => 29000
                        [discount] => 5
                    )

            )

        [media_format] => VCD
    )

[6] => Array
    (
        [id] => 30074
        [product_id] => Array
            (
                [0] => stdClass Object
                    (
                        [id] => 1470
                        [type_id] => 1
                        [title] => Hearth 2 Hearth
                        [cover] => 149ddd4d1d5e567c1300d4831323e1c5.jpg
                        [coverid] => 1177
                        [inserted_by] => 6
                        [inserted_date] => 2011-02-16 15:18:58
                        [status_id] => 0
                    )

            )

        [variable_id] => 9
        [variable_value] => 2011-02-11
        [master_value] => 
        [released_date] => 2011-02-11
        [price] => Array
            (
                [0] => Array
                    (
                        [product_id] => 1470
                        [media_format] => DVD
                        [price] => 39000
                        [discount] => 0
                    )

            )

        [media_format] => DVD
    )

我想通过media_format = DVD获得结果,所以整个数组都消失了,无论如何要删除数组还是删除它?

1 个答案:

答案 0 :(得分:4)

与“删除”任何变量的方式相同:

unset($array[$index]);