$freeDistance * 1000) { $fee = ceil(($distance - $freeDistance * 1000) / 1000) * $perKiloFee; } $showDistance = sprintf("%.1f", ($distance / 1000)); return ['distance' => $distance, 'showDistance' => $showDistance, 'fee' => $fee]; } }