user533507
user533507

Reputation:

How do I print the data within this nested stdClass Object?

I am attempting to print values within this nested stdClass Object but I'm having trouble accessing them. How do I print, for example, the value of "originCity"?

stdClass Object (
    [FlightInfoResult] => stdClass Object (
        [next_offset] => 1 
        [flights] => stdClass Object (
            [ident] => SWA2558
            [aircrafttype] => B737
            [filed_ete] => 00:50:00
            [filed_time] => 1362879561
            [filed_departuretime] => 1362880080
            [filed_airspeed_kts] => 442
            [filed_airspeed_mach] => 
            [filed_altitude] => 410
            [route] => LBY MEI J31 VUZ
            [actualdeparturetime] => 1362880080
            [estimatedarrivaltime] => 1362882900
            [actualarrivaltime] => 1362882600
            [diverted] => [origin] => KMSY
            [destination] => KBHM
            [originName] => New Orleans Intl
            [originCity] => New Orleans, LA
            [destinationName] => Birmingham-Shuttlesworth Intl
            [destinationCity] => Birmingham, AL
        )
    )
)

Upvotes: 0

Views: 5723

Answers (2)

Philipp
Philipp

Reputation: 15629

Try

$var->FlightInfoResult->flights->originCity

Upvotes: 5

user2189593
user2189593

Reputation:

you can use

$object->FlightInfoResult->flights->originCity;

to access objects properties.

sorry about that.

Upvotes: 2

Related Questions