在PHP中需要一个用于动态MULTIDIMENSIONAL ARRAY显示的显示功能

QS1. The results mention below is from one array ( got from WEBSERVICE CALL using SOAP). i have some confusion regarding accessing elements from the array. As seen from the results, sometime results comes as an ARRAY (in second result) where as sometimes results comes without array index (first results). SO how can I use the best method for displaying elements like array["AirportCode"] for getting accurate results and display output TO user.

*********************
RESULTS SET-1
********************

  Array
    (
    [SegmentIndicator] => 1
    [Airline] => Array
    (
    [AirlineCode] => SG
    [AirlineName] => SpiceJet
    [AirLineRemarks] => SG Star Coupon
    )

    [FlightNumber] => 894
    [FareClass] => K
    [Origin] => Array
    (
    [AirportCode] => GAU
    [AirportName] => Borjhar
    [Terminal] =>
    [CityCode] => GAU
    [CityName] => Guwahati
    [CountryCode] => IN
    [CountryName] => India
    )

    [Destination] => Array
    (
    [AirportCode] => DEL
    [AirportName] => Indira Gandhi Airport
    [Terminal] => 1C
    [CityCode] => DEL
    [CityName] => Delhi
    [CountryCode] => IN
    [CountryName] => India
    )

    [DepTIme] => 2014-12-26T11:05:00
    [ArrTime] => 2014-12-26T14:00:00
    [ETicketEligible] => 1
    [Duration] => 02:55
    [Stop] => 0
    [Craft] => 738
    [Status] => Confirmed
    [OperatingCarrier] => SG
    )
*****************************************
RESULTS SET-2
****************************************
Array
(
[0] => Array
(
[SegmentIndicator] => 1
[Airline] => Array
(
[AirlineCode] => AI
[AirlineName] => Air India
[AirLineRemarks] => This JetAirways series are operated by JetLite
)

[FlightNumber] => 401
[FareClass] => Y
[Origin] => Array
(
[AirportCode] => DEL
[AirportName] => Indira Gandhi Airport
[Terminal] => 3
[CityCode] => DEL
[CityName] => Delhi
[CountryCode] => IN
[CountryName] => India
)

[Destination] => Array
(
[AirportCode] => CCU
[AirportName] => Calcutta
[Terminal] => 2
[CityCode] => CCU
[CityName] => Kolkata
[CountryCode] => IN
[CountryName] => India
)

[DepTIme] => 2014-12-31T07:00:00
[ArrTime] => 2014-12-31T09:05:00
[ETicketEligible] => 1
[Duration] => 00:00
[Stop] => 0
[Craft] => 321
[Status] => Confirmed
[OperatingCarrier] => AI
)

[1] => Array
(
[SegmentIndicator] => 1
[Airline] => Array
(
[AirlineCode] => 9W
[AirlineName] => Jet Airways
[AirLineRemarks] => This JetAirways series are operated by JetLite
)

[FlightNumber] => 2363
[FareClass] => H
[Origin] => Array
(
[AirportCode] => CCU
[AirportName] => Calcutta
[Terminal] =>
[CityCode] => CCU
[CityName] => Kolkata
[CountryCode] => IN
[CountryName] => India
)

[Destination] => Array
(
[AirportCode] => GAU
[AirportName] => Borjhar
[Terminal] =>
[CityCode] => GAU
[CityName] => Guwahati
[CountryCode] => IN
[CountryName] => India
)

[DepTIme] => 2014-12-31T10:45:00
[ArrTime] => 2014-12-31T11:55:00
[ETicketEligible] => 1
[Duration] => 00:00
[Stop] => 0
[Craft] => 738
[Status] => Confirmed
[OperatingCarrier] => 9W
)

I'll write a loop that will work both case. I'll show only one var -> AirportCode <-

first, i'll have a var called myArray with the array.

$myArray = .... // Do what you need to populate it.

Now let's make a cicle.

for ($i = 0; $i < count($myArray); $i++){
 if(isset($myArray[$i]['AirportCode'])){
  print  $myArray[$i]['AirportCode'];
}
}

You need however to test this code.