我正在尝试将变量从公共函数发送到私有静态函数,如下所示:
public function getAirportFare($fare) {
$fare2 = 1000;
return self::getFinalFare($fare, $fare2);
}
至:
private static function getFinalFare($fare, $fare2) {
$fare = $fare + $fare2;
$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;
}
return number_format($final_fare,2);
}
但是 getFinalFare 函数中的 $fare2 是未定义的?我只是想知道如何传递这个值?