Test it
$flights = ACARSData::GetACARSData();
if(!$flights)
$flights = array();
$this->acarsflights = array();
foreach($flights as $flight)
{
if($flight->route == '')
{
$flight->route_details = array();
}
else
{
$flight->route_details = NavData::parseRoute($flight->route);
}
$c = (array) $flight; // Convert the object to an array
$c['pilotid'] = PilotData::GetPilotCode($c['code'], $c['pilotid']);
$totaldistance = round(SchedulesData::distanceBetweenPoints($flight->deplat, $flight->deplng, $flight->arrlat, $flight->arrlng));
$percomplete = ABS(number_format(((($totaldistance - $flight->distremain) / $totaldistance) * 100), 2));
if($percomplete <= '0'){ $percomplete = '100'; } else { $percomplete = $percomplete; }
$c['percomplete'] = $percomplete;