基本上,我有两个函数,如下所示,第一个函数检查接送是否是机场地址(通过 ajax 从 jquery 函数发送)。如果它是机场,基本上我想将变量 $fare 从 getAirportFare 函数发送到 getFinalFare 函数,这样如果它是机场地址,它就会增加费用。我只是想知道我将如何做到这一点?(还在努力学习PHP)
任何帮助将非常感激。
//DEBUG//
public function getAirportFare($fare, $fieldAirport) {
if ($fieldAirport == 'airport') {
$fare = $fare + 50.00;
return $fare;
}
}
//END OF DEBUG//
private static function getFinalFare($fare) {
$final_fare = ($fare * self::$fare_factor);
if (self::$str_wait_return == "true") {
$final_fare = $final_fare * 2;
}
if (self::$str_return == "true" && self::$return_date != "false" && self::$return_time != "false") {
// We need to calc to fare based on the return date and time
$return_fare = self::getFare(1);
// Append to final fare
$final_fare = $final_fare + $return_fare;
}
// Create new journey object with the info that we have so far
/*$journey = new Journey($journey_id,$pickup,$dropoff,$vias,$distance,$vehicle,
$date_time,$return_journey,$meet_greet,$extras);*/
return number_format($final_fare,2);
}