数组合并不同的值,而不是键的相同值

时间:2018-09-20 10:22:18

标签: php arrays

以下数组具有相同的键和值,但仅提供便利,我需要将两者合并

                [0] => stdClass Object
                    (
                        [room_id] => 15
                        [room] => deluxee
                        [price] => 2000.00
                        [amenities] => Swimming Pool
                        [photo_path] => 1\15\11790549875ba35c08e26b6.jpg
                    )

                [1] => stdClass Object
                    (
                        [room_id] => 15
                        [room] => deluxee
                        [price] => 2000.00
                        [amenities] => Double Bedroom
                        [photo_path] => 1\15\11790549875ba35c08e26b6.jpg
                    )

所以我需要输出我该怎么办?

                [0] => stdClass Object
                    (
                        [room_id] => 15
                        [room] => deluxee
                        [price] => 2000.00
                        [amenities] => stdClass Object
                                           (
                                           [0] => Swimming Pool
                                           [1] =>Double Bedroom
                                            )
                        [photo_path] => 1\15\11790549875ba35c08e26b6.jpg
                    )

0 个答案:

没有答案