从多维数组中完全删除空数组

时间:2015-04-21 08:27:42

标签: php multidimensional-array

我们说我有以下数组:

Array
(
    [Particulier] => Array
        (
            [Weekend] => Array
                (
                    [2015] => Array
                        (
                            [01] => Array
                                (
                                )

                            [02] => Array
                                (
                                )

                            [03] => Array
                                (
                                )

                            [04] => Array
                                (
                                    [startDate] => 24-04-2015
                                    [endDate] => 27-04-2015
                                )

                            [05] => Array
                                (
                                    [startDate] => 01-05-2015
                                    [endDate] => 04-05-2015
                                )

                            [06] => Array
                                (
                                )

我可以完全删除所有空数组(包括键), 像这样:

Array
(
    [Particulier] => Array
        (
            [Weekend] => Array
                (
                    [2015] => Array
                        (
                            [04] => Array
                                (
                                    [startDate] => 24-04-2015
                                    [endDate] => 27-04-2015
                                )

                            [05] => Array
                                (
                                    [startDate] => 01-05-2015
                                    [endDate] => 04-05-2015
                                )

如果需要任何其他信息,请询问。我是新手。 提前谢谢!

0 个答案:

没有答案