I want to combine the three arrays shown below and I don't know how to do that, I want to take the companyCode
of each array and make it for one array.
I have an array like this,
Array(
[0] => Array(
[companyCode] => SimpleXMLElement Object(
[0] => 'AD'
)
[name] => SimpleXMLElement Object(
[0] => 'NYCT01'
)
[vehicleRentalPrefType] => SimpleXMLElement Object(
[0] => 'ECAR'
)
[rateAmount] => SimpleXMLElement Object(
[0] => '295.62'
)
);
[1] => Array(
[companyCode] => SimpleXMLElement Object(
[0] => 'AD'
)
[name] => SimpleXMLElement Object(
[0] => 'NYCT01'
)
[vehicleRentalPrefType] => SimpleXMLElement Object(
[0] => 'SCAR'
)
[rateAmount] => SimpleXMLElement Object(
[0] => '356.25'
)
[2] => Array(
[companyCode] => SimpleXMLElement Object(
[0] => 'AD'
)
[name] => SimpleXMLElement Object(
[0] => 'NYCT01'
)
[vehicleRentalPrefType] => SimpleXMLElement Object(
[0] => 'PCAR'
)
[rateAmount] => SimpleXMLElement Object(
[0] => '562.36'
)
)
)
I want this:
Array(
[AD] => Array(
[NYCT01] => Array(
[ECAR] => Array(
[0] => '295.62'
)
[SCAR] => Array(
[0] => '356.25'
)
[PCAR] => Array(
[0] => '562.36'
)
)
)
)
How can I do that, I tried to do some loops but I'm getting no result please help.