I have this array structure:
stdClass Object
(
[carrierFsCode] => VX
[flightNumber] => 925
[departureAirportFsCode] => LAX
[arrivalAirportFsCode] => SFO
[stops] => 0
[departureTerminal] => 3
[arrivalTerminal] => 2
[departureTime] => 2014-04-28T07:00:00.000
[arrivalTime] => 2014-04-28T08:20:00.000
[flightEquipmentIataCode] => 32S
[isCodeshare] =>
[isWetlease] =>
[serviceType] => J
[serviceClasses] => Array
(
[0] => F
[1] => J
[2] => Y
)
[trafficRestrictions] => Array
(
)
[codeshares] => Array
(
[0] => stdClass Object
(
[carrierFsCode] => SQ
[flightNumber] => 1407
[serviceType] => J
[serviceClasses] => Array
(
[0] => R
[1] => F
[2] => J
[3] => Y
)
[trafficRestrictions] => Array
(
[0] => Q
)
[referenceCode] => 10594616
)
)
[referenceCode] => 979-1740743--
)
stdClass Object
(
[carrierFsCode] => SQ
[flightNumber] => 1407
[departureAirportFsCode] => LAX
[arrivalAirportFsCode] => SFO
[stops] => 0
[departureTerminal] => 3
[arrivalTerminal] => 2
[departureTime] => 2014-04-28T07:00:00.000
[arrivalTime] => 2014-04-28T08:20:00.000
[flightEquipmentIataCode] => 32S
[isCodeshare] => 1
[isWetlease] =>
[serviceType] => J
[serviceClasses] => Array
(
[0] => R
[1] => F
[2] => J
[3] => Y
)
[trafficRestrictions] => Array
(
[0] => Q
)
[operator] => stdClass Object
(
[carrierFsCode] => VX
[flightNumber] => 925
[serviceType] => J
[serviceClasses] => Array
(
[0] => F
[1] => J
[2] => Y
)
[trafficRestrictions] => Array
(
)
)
[codeshares] => Array
(
)
[referenceCode] => 979-1740743--10594616
)
And this array structure:
Array
(
[0] => stdClass Object
(
[fs] => SQ
[iata] => SQ
[icao] => SIA
[name] => Singapore Airlines
[active] => 1
)
[1] => stdClass Object
(
[fs] => VX
[iata] => VX
[icao] => VRD
[name] => Virgin America
[active] => 1
)
)
Basically what I want to do is take the first array and find its matching IATA/FS code in the second array and replace it with the ICAO code. So for example, with the first array, I want to replace the VX with VRD. I want to be able to apply the same concept to other airline/routes, too...not just VX.
If it helps, I'm getting this information from a JSON return: http://pastebin.com/2w0kQQ26
I looked into array_replace(), but because my PHP skills are almost nothing, I didn't know how to continue.
If someone can point me to the right direction, I'd appreciate it.