1

過去2日間にインターネットを検索しましたが、問題の解決策が見つかりませんでした。

PHPを使用してSOAPWebサービスと通信するWebアプリケーションを作成していますが、Webサービスの応答を取得すると、結果をいくつかの配列で出力するので、1つの配列を別の配列に一致させたいと思います。

たとえば、$company5つの会社の場所のリストを含む配列$ratesがあり、37の料金と価格のリストを含む別の配列がありますが、それが属する場所の各価格を一致させる必要があり、方法がわかりません。それを行う。

できる限り短くしようとした長い例で申し訳ありませんが、私が何を意味するのかを理解してほしい

    Array
    (
        [0] => SimpleXMLElement Object
            (
                [Car_AvailabilityReply] => SimpleXMLElement Object
                    (
                        [availabilityDetails] => SimpleXMLElement Object
                            (
                                [computeMarkups] => SimpleXMLElement Object
                                    (
                                        [actionRequestCode] => N
                                    )

                                [rateClass] => SimpleXMLElement Object
                                    (
                                        [criteriaSetType] => COR
                                    )

                                [companyLocationInfo] => Array
                                    (
                                        [0] => SimpleXMLElement Object
                                            (
                                                [carCompanyData] => SimpleXMLElement Object
                                                    (
                                                        [companyName] => AVIS
                                                    )

                                                [rentalLocation] => SimpleXMLElement Object
                                                    (
                                                        [address] => SimpleXMLElement Object
                                                            (
                                                                [addressDetails] => SimpleXMLElement Object
                                                                    (
                                                                        [line1] => 420 EAST 90TH STREET
                                                                    )
                                                                [locationDetails] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC07
                                                                    )

                                                            )

                                                    )

                                            )

                                        [1] => SimpleXMLElement Object
                                            (
                                                [carCompanyData] => SimpleXMLElement Object
                                                    (
                                                        [companyName] => AVIS
                                                    )

                                                [rentalLocation] => SimpleXMLElement Object
                                                    (
                                                        [address] => SimpleXMLElement Object
                                                            (
                                                                [addressDetails] => SimpleXMLElement Object
                                                                    (
                                                                        [line1] => 310 EAST 64TH STREET
                                                                    )

                                                                [locationDetails] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC06
                                                                    )

                                                            )

                                                    )

                                            )

                                        [2] => SimpleXMLElement Object
                                            (
                                                [carCompanyData] => SimpleXMLElement Object
                                                    (
                                                        [companyName] => AVIS
                                                    )

                                                [rentalLocation] => SimpleXMLElement Object
                                                    (
                                                        [address] => SimpleXMLElement Object
                                                            (
                                                                [addressDetails] => SimpleXMLElement Object
                                                                    (
                                                                        [line1] => 68 EAST 11TH STREET
                                                                    )

                                                                [locationDetails] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC03
                                                                    )

                                                            )

                                                    )

                                            )

                                    )

                                [rates] => Array
                                    (
                                        [0] => SimpleXMLElement Object
                                            (
                                                [vehicleTypeInfo] => SimpleXMLElement Object
                                                    (
                                                        [vehicleCharacteristic] => SimpleXMLElement Object
                                                            (
                                                                [vehicleRentalPrefType] => CCAR
                                                            )

                                                    )

                                                [carCompanyData] => SimpleXMLElement Object
                                                    (
                                                        [companyName] => AVIS
                                                    )

                                                [pickupDropoffLocations] => Array
                                                    (
                                                        [0] => SimpleXMLElement Object
                                                            (
                                                                [locationType] => PUP
                                                                [locationDescription] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC07
                                                                    )

                                                            )

                                                        [1] => SimpleXMLElement Object
                                                            (
                                                                [locationType] => DOL
                                                                [locationDescription] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC07
                                                                    )

                                                            )

                                                    )

                                                [rateDetailsInfo] => SimpleXMLElement Object
                                                    (
                                                        [tariffInfo] => Array
                                                            (
                                                                [0] => SimpleXMLElement Object
                                                                    (
                                                                        [rateAmount] => 83.99
                                                                        [rateCurrency] => USD
                                                                    )

                                                                [1] => SimpleXMLElement Object
                                                                    (
                                                                        [rateAmount] => 100.68
                                                                        [rateCurrency] => USD
                                                                    )

                                                            )

                                                    )

                                            )

                                        [1] => SimpleXMLElement Object
                                            (
                                                [vehicleTypeInfo] => SimpleXMLElement Object
                                                    (
                                                        [vehicleCharacteristic] => SimpleXMLElement Object
                                                            (
                                                                [vehicleRentalPrefType] => CCAR
                                                            )

                                                    )

                                                [carCompanyData] => SimpleXMLElement Object
                                                    (
                                                        [companyName] => AVIS
                                                    )

                                                [pickupDropoffLocations] => Array
                                                    (
                                                        [0] => SimpleXMLElement Object
                                                            (
                                                                [locationType] => PUP
                                                                [locationDescription] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC06
                                                                    )

                                                            )

                                                        [1] => SimpleXMLElement Object
                                                            (
                                                                [locationType] => DOL
                                                                [locationDescription] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC06
                                                                    )

                                                            )

                                                    )

                                                [rateDetailsInfo] => SimpleXMLElement Object
                                                    (
                                                        [tariffInfo] => Array
                                                            (
                                                                [0] => SimpleXMLElement Object
                                                                    (
                                                                        [rateAmount] => 83.99
                                                                        [rateCurrency] => USD
                                                                    )

                                                                [1] => SimpleXMLElement Object
                                                                    (
                                                                        [rateAmount] => 100.68
                                                                        [rateCurrency] => USD
                                                                    )

                                                            )

                                                    )

                                            )

                                        [2] => SimpleXMLElement Object
                                            (
                                                [vehicleTypeInfo] => SimpleXMLElement Object
                                                    (
                                                        [vehicleCharacteristic] => SimpleXMLElement Object
                                                            (
                                                                [vehicleRentalPrefType] => CCAR
                                                            )

                                                    )

                                                [carCompanyData] => SimpleXMLElement Object
                                                    (
                                                        [companyName] => AVIS
                                                    )

                                                [pickupDropoffLocations] => Array
                                                    (
                                                        [0] => SimpleXMLElement Object
                                                            (
                                                                [locationType] => PUP
                                                                [locationDescription] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC03
                                                                    )

                                                            )

                                                        [1] => SimpleXMLElement Object
                                                            (
                                                                [locationType] => DOL
                                                                [locationDescription] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC03
                                                                    )

                                                            )

                                                    )

                                                [rateDetailsInfo] => SimpleXMLElement Object
                                                    (
                                                        [tariffInfo] => Array
                                                            (
                                                                [0] => SimpleXMLElement Object
                                                                    (
                                                                        [rateAmount] => 83.99
                                                                        [rateCurrency] => USD
                                                                    )

                                                                [1] => SimpleXMLElement Object
                                                                    (
                                                                        [rateAmount] => 100.68
                                                                        [rateCurrency] => USD
                                                                    )

                                                            )

                                                    )

                                            )

                                        [3] => SimpleXMLElement Object
                                            (
                                                [vehicleTypeInfo] => SimpleXMLElement Object
                                                    (
                                                        [vehicleCharacteristic] => SimpleXMLElement Object
                                                            (
                                                                [vehicleRentalPrefType] => EDAR
                                                            )

                                                    )

                                                [carCompanyData] => SimpleXMLElement Object
                                                    (
                                                        [companyName] => AVIS
                                                    )

                                                [pickupDropoffLocations] => Array
                                                    (
                                                        [0] => SimpleXMLElement Object
                                                            (
                                                                [locationType] => PUP
                                                                [locationDescription] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC03
                                                                    )

                                                            )

                                                        [1] => SimpleXMLElement Object
                                                            (
                                                                [locationType] => DOL
                                                                [locationDescription] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC03
                                                                    )

                                                            )

                                                    )

                                                [rateDetailsInfo] => SimpleXMLElement Object
                                                    (
                                                        [tariffInfo] => Array
                                                            (
                                                                [0] => SimpleXMLElement Object
                                                                    (
                                                                        [rateAmount] => 83.99
                                                                        [rateCurrency] => USD
                                                                    )

                                                                [1] => SimpleXMLElement Object
                                                                    (
                                                                        [rateAmount] => 100.68
                                                                        [rateCurrency] => USD
                                                                    )

                                                            )

                                                    )

                                            )

                                        [4] => SimpleXMLElement Object
                                            (
                                                [vehicleTypeInfo] => SimpleXMLElement Object
                                                    (
                                                        [vehicleCharacteristic] => SimpleXMLElement Object
                                                            (
                                                                [vehicleRentalPrefType] => EDAR
                                                            )

                                                    )

                                                [carCompanyData] => SimpleXMLElement Object
                                                    (
                                                        [companyName] => AVIS
                                                    )

                                                [pickupDropoffLocations] => Array
                                                    (
                                                        [0] => SimpleXMLElement Object
                                                            (
                                                                [locationType] => PUP
                                                                [locationDescription] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC06
                                                                    )

                                                            )

                                                        [1] => SimpleXMLElement Object
                                                            (
                                                                [locationType] => DOL
                                                                [locationDescription] => SimpleXMLElement Object
                                                                    (
                                                                        [name] => NYCC06
                                                                    )

                                                            )

                                                    )

                                                [rateDetailsInfo] => SimpleXMLElement Object
                                                    (
                                                        [tariffInfo] => Array
                                                            (
                                                                [0] => SimpleXMLElement Object
                                                                    (
                                                                        [rateAmount] => 83.99
                                                                        [rateCurrency] => USD
                                                                    )

                                                                [1] => SimpleXMLElement Object
                                                                    (
                                                                        [rateAmount] => 100.68
                                                                        [rateCurrency] => USD
                                                                    )

                                                            )

                                                    )

                                            )

                                     )

                            )

                    )

            )

    )

2種類の配列があることがわかるとしたら、最初の3つは場所で、2つ目は価格のある車であり、各車を正しい場所に配置する必要があります。

さらに説明が必要な場合は教えてください。

それを手伝ってください、ありがとう。

4

0 に答える 0