保留相同的数组键值,在php数组

时间:2017-03-31 07:09:58

标签: php arrays

我有以下PHP数组

Array
(
    [attendees] => Array
        (
            [322] => Array
                (
                    [0] => Array
                        (
                            [attendee_name] => Amy Rainwater
                            [attendee_email] => arainwater@azdps.gov
                            [attendee_phone] => 345676575
                        )

                    [1] => Array
                        (
                            [attendee_name] => Lisa Hernandez
                            [attendee_email] => lhernandez@azdps.gov
                            [attendee_phone] => 34565
                        )

                )

        )

    [registration] => Array
        (
            [user_name] => Amy Rainwater
            [user_email] => arainwater@azdps.gov
            [dbem_name] => Lisa Hernandez
            [dbem_email] => lhernandez@azdps.gov
            [dbem_address] => PO Box 6638
            [dbem_phone] => 343545546
            [dbem_city] => Ph
            [dbem_state] => Arz
            [dbem_zip] => 85334
            [dbem_company] => Arizona Department of Public Safety
        )

    [gateway] => authorize_aim
)

我想保留[与会者] [322] [0]此关键值,其他[1]从与会者数组中删除。目前你可以看到有三个数组。因此,在第一个阵列(参加者)中,我们有价值“amy雨水”,所以我想保留这个关键值和其他关键值,即[0] - > Lisa Hernandez这个sholud从那里删除。所以请说明如何过滤这个数组。

由于

1 个答案:

答案 0 :(得分:0)

您可以使用reset

reset($res_booking_meta['attendees'][322]);