php array_filter如果时间在1小时之内

I am trying to figure out how to filter an object based on a comparison.

I get an object that looks something like this, although with 15 results....

stdClass Object
(
    [FlightInfoExResult] => stdClass Object
        (
            [next_offset] => 15
            [flights] => Array
                (
                    [0] => stdClass Object
                        (
                            [faFlightID] => SWA2078-1499232401-airline-0885
                            [ident] => SWA2078
                            [aircrafttype] => B738
                            [filed_ete] => 03:00:00
                            [filed_time] => 1499232401
                            [filed_departuretime] => 1499477700
                            [filed_airspeed_kts] => 423
                            [filed_airspeed_mach] => 
                            [filed_altitude] => 0
                            [route] => 
                            [actualdeparturetime] => 0
                            [estimatedarrivaltime] => 1499489100
                            [actualarrivaltime] => 0
                            [diverted] => 
                            [origin] => KPHX
                            [destination] => KMKE
                            [originName] => Phoenix Sky Harbor Intl
                            [originCity] => Phoenix, AZ
                            [destinationName] => General Mitchell Intl

i need to filter this object so only return the [flights] where [filed_departuretime] is within 1 hour of Query result $time = strtotime($item['departure_time']);

by doing something like this:

abs($object->filed_departuretime - $time) <= 3600)

hopefully this all makes sense, thanks for your help :) I dont really know how array_filter works so this is what I have so far....

//set flight identity
$ident = $item['airline'].$item['flight_number'];
$date = date('Y-m-d H:i:s');
$time = strtotime($item['departure_time']);

//get flightaware results
$flightAwareResult = FlightInfoEx($ident);

/*$flightResult = array_filter(
  $flightAwareResult,
);*/

Array filter takes an array and passes each element through a function. It only keeps elements for which the function returned a true value. Example:

//set flight identity
$ident = $item['airline'].$item['flight_number'];
$date = date('Y-m-d H:i:s');
$time = strtotime($item['departure_time']);

//get flightaware results
$flightAwareResult = FlightInfoEx($ident);
$filtered_array = array_filter($flightAwareResult->FlightInfoExResult->flights, function ($value) use ($time) { 
      return  $time - $value->filed_departuretime) <= 3600; 
}); 

Just try this

$object='';
$object=json_decode(json_encode($object,true),true);
$result=array_map(function ($array){
    $time = strtotime($array['departure_time']);
    if(($array['filed_departuretime'] - $time) <= 3600){
        return $array;
    }
},$object['FlightInfoExResult']['flights']);
$result=array_filter($result);

In place of $object put your object variable name.

I thing it will help you.