Note that there are some explanatory texts on larger screens.

plurals
  1. POMatch two arrays from a SOAP XML response in PHP
    primarykey
    data
    text
    <p>I searched around the internet in the last 2 days and I didn't found any solution to my problem,</p> <p>I'm making a web application using PHP communicating with SOAP Web Services, and when I'm getting the respond of the Web Service I output the result in a few arrays, so now I want to match 1 array to another,</p> <p>for example, I have array <code>$company</code> containing a list of 5 company locations, and then I have another array <code>$rates</code> containing a list of 37 rates and prices but I have to match each price in which location it belongs to, and I don't know how to do that.</p> <p>I'm sorry for the long example I tried to make the shortest that I can, but I want you should understand what I mean</p> <pre><code> Array ( [0] =&gt; SimpleXMLElement Object ( [Car_AvailabilityReply] =&gt; SimpleXMLElement Object ( [availabilityDetails] =&gt; SimpleXMLElement Object ( [computeMarkups] =&gt; SimpleXMLElement Object ( [actionRequestCode] =&gt; N ) [rateClass] =&gt; SimpleXMLElement Object ( [criteriaSetType] =&gt; COR ) [companyLocationInfo] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [carCompanyData] =&gt; SimpleXMLElement Object ( [companyName] =&gt; AVIS ) [rentalLocation] =&gt; SimpleXMLElement Object ( [address] =&gt; SimpleXMLElement Object ( [addressDetails] =&gt; SimpleXMLElement Object ( [line1] =&gt; 420 EAST 90TH STREET ) [locationDetails] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC07 ) ) ) ) [1] =&gt; SimpleXMLElement Object ( [carCompanyData] =&gt; SimpleXMLElement Object ( [companyName] =&gt; AVIS ) [rentalLocation] =&gt; SimpleXMLElement Object ( [address] =&gt; SimpleXMLElement Object ( [addressDetails] =&gt; SimpleXMLElement Object ( [line1] =&gt; 310 EAST 64TH STREET ) [locationDetails] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC06 ) ) ) ) [2] =&gt; SimpleXMLElement Object ( [carCompanyData] =&gt; SimpleXMLElement Object ( [companyName] =&gt; AVIS ) [rentalLocation] =&gt; SimpleXMLElement Object ( [address] =&gt; SimpleXMLElement Object ( [addressDetails] =&gt; SimpleXMLElement Object ( [line1] =&gt; 68 EAST 11TH STREET ) [locationDetails] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC03 ) ) ) ) ) [rates] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [vehicleTypeInfo] =&gt; SimpleXMLElement Object ( [vehicleCharacteristic] =&gt; SimpleXMLElement Object ( [vehicleRentalPrefType] =&gt; CCAR ) ) [carCompanyData] =&gt; SimpleXMLElement Object ( [companyName] =&gt; AVIS ) [pickupDropoffLocations] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [locationType] =&gt; PUP [locationDescription] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC07 ) ) [1] =&gt; SimpleXMLElement Object ( [locationType] =&gt; DOL [locationDescription] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC07 ) ) ) [rateDetailsInfo] =&gt; SimpleXMLElement Object ( [tariffInfo] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [rateAmount] =&gt; 83.99 [rateCurrency] =&gt; USD ) [1] =&gt; SimpleXMLElement Object ( [rateAmount] =&gt; 100.68 [rateCurrency] =&gt; USD ) ) ) ) [1] =&gt; SimpleXMLElement Object ( [vehicleTypeInfo] =&gt; SimpleXMLElement Object ( [vehicleCharacteristic] =&gt; SimpleXMLElement Object ( [vehicleRentalPrefType] =&gt; CCAR ) ) [carCompanyData] =&gt; SimpleXMLElement Object ( [companyName] =&gt; AVIS ) [pickupDropoffLocations] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [locationType] =&gt; PUP [locationDescription] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC06 ) ) [1] =&gt; SimpleXMLElement Object ( [locationType] =&gt; DOL [locationDescription] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC06 ) ) ) [rateDetailsInfo] =&gt; SimpleXMLElement Object ( [tariffInfo] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [rateAmount] =&gt; 83.99 [rateCurrency] =&gt; USD ) [1] =&gt; SimpleXMLElement Object ( [rateAmount] =&gt; 100.68 [rateCurrency] =&gt; USD ) ) ) ) [2] =&gt; SimpleXMLElement Object ( [vehicleTypeInfo] =&gt; SimpleXMLElement Object ( [vehicleCharacteristic] =&gt; SimpleXMLElement Object ( [vehicleRentalPrefType] =&gt; CCAR ) ) [carCompanyData] =&gt; SimpleXMLElement Object ( [companyName] =&gt; AVIS ) [pickupDropoffLocations] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [locationType] =&gt; PUP [locationDescription] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC03 ) ) [1] =&gt; SimpleXMLElement Object ( [locationType] =&gt; DOL [locationDescription] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC03 ) ) ) [rateDetailsInfo] =&gt; SimpleXMLElement Object ( [tariffInfo] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [rateAmount] =&gt; 83.99 [rateCurrency] =&gt; USD ) [1] =&gt; SimpleXMLElement Object ( [rateAmount] =&gt; 100.68 [rateCurrency] =&gt; USD ) ) ) ) [3] =&gt; SimpleXMLElement Object ( [vehicleTypeInfo] =&gt; SimpleXMLElement Object ( [vehicleCharacteristic] =&gt; SimpleXMLElement Object ( [vehicleRentalPrefType] =&gt; EDAR ) ) [carCompanyData] =&gt; SimpleXMLElement Object ( [companyName] =&gt; AVIS ) [pickupDropoffLocations] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [locationType] =&gt; PUP [locationDescription] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC03 ) ) [1] =&gt; SimpleXMLElement Object ( [locationType] =&gt; DOL [locationDescription] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC03 ) ) ) [rateDetailsInfo] =&gt; SimpleXMLElement Object ( [tariffInfo] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [rateAmount] =&gt; 83.99 [rateCurrency] =&gt; USD ) [1] =&gt; SimpleXMLElement Object ( [rateAmount] =&gt; 100.68 [rateCurrency] =&gt; USD ) ) ) ) [4] =&gt; SimpleXMLElement Object ( [vehicleTypeInfo] =&gt; SimpleXMLElement Object ( [vehicleCharacteristic] =&gt; SimpleXMLElement Object ( [vehicleRentalPrefType] =&gt; EDAR ) ) [carCompanyData] =&gt; SimpleXMLElement Object ( [companyName] =&gt; AVIS ) [pickupDropoffLocations] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [locationType] =&gt; PUP [locationDescription] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC06 ) ) [1] =&gt; SimpleXMLElement Object ( [locationType] =&gt; DOL [locationDescription] =&gt; SimpleXMLElement Object ( [name] =&gt; NYCC06 ) ) ) [rateDetailsInfo] =&gt; SimpleXMLElement Object ( [tariffInfo] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [rateAmount] =&gt; 83.99 [rateCurrency] =&gt; USD ) [1] =&gt; SimpleXMLElement Object ( [rateAmount] =&gt; 100.68 [rateCurrency] =&gt; USD ) ) ) ) ) ) ) ) ) </code></pre> <p>If you understand that you can see there is two type of arrays the first 3 is the location and the second is the cars with price, and I have to put each car to the correct location.</p> <p>If you need more explanation please tell me.</p> <p>Please help me out with that, Thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload