当子数组包含特定值时,如何排除数组

时间:2017-02-28 18:15:41

标签: php arrays

我有如下所示的数组代码

Array
(
    [52] => stdClass Object
        (
            [ID] => 52
            [post_author] => 1
        )

    [53] => stdClass Object
        (
            [ID] => 53
            [post_author] => 2
        )

    [10] => stdClass Object
        (
            [ID] => 10
            [post_author] => 2
        )

    [9] => stdClass Object
        (
            [ID] => 9
            [post_author] => 1
        )

)

如何排除包含[post_author] =>的结果2所以结果将是这样的(在谷歌搜索,但不知道什么是解决这个问题的正确关键词,这里的新闻:D)

Array
(
    [52] => stdClass Object
        (
            [ID] => 52
            [post_author] => 1
        )

    [9] => stdClass Object
        (
            [ID] => 9
            [post_author] => 1
        )

)

谢谢

0 个答案:

没有答案