我在过去两天内在网上搜索过,我没有找到解决问题的方法,
我正在使用PHP与SOAP Web Services进行通信来创建Web应用程序,当我收到Web Service的响应时,我将结果输出到几个数组中,所以现在我想将1个数组与另一个数组匹配,
例如,我有数组$company
包含5个公司位置的列表,然后我有另一个数组$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
)
)
)
)
)
)
)
)
)
如果你明白你可以看到有两种类型的阵列,前三个是位置,第二个是有价格的车,我必须将每辆车放到正确的位置。
如果您需要更多解释,请告诉我。
请帮帮我, 谢谢。