Estimated rider price
"; $tax1=0.5; // tax from 0 to 5 km of job_distance $tax2=0.7; // tax from 5.1 to every value $limit=5; // limit distance for tax1 echo "limit distance for tax1 is: " . $limit. "
"; echo "tax1 is: " . $tax1. "
"; echo "tax2 for more of limit distance is: " . $tax2. "
"; //how I have calculed it if($j_d <= $limit){ // if job_distance is <= 5 $result=$j_d * $tax1; // result is (job_distance * tax1) }else{ $result=(($tax1 * $limit)+(($j_d - $limit)*$tax2)); // in other case result is // (tax1 * limit distance tax1) + ((job_distance - limit d tax1)*tax2) } echo "----------> THE RESULT IS: € " . $result;
"; $tax1=0.5; // tax from 0 to 5 km of job_distance $tax2=0.7; // tax from 5.1 to every value $limit=5; // limit distance for tax1 echo "limit distance for tax1 is: " . $limit. "
"; echo "tax1 is: " . $tax1. "
"; echo "tax2 for more of limit distance is: " . $tax2. "
"; //how I have calculed it if($j_d <= $limit){ // if job_distance is <= 5 $result=$j_d * $tax1; // result is (job_distance * tax1) }else{ $result=(($tax1 * $limit)+(($j_d - $limit)*$tax2)); // in other case result is // (tax1 * limit distance tax1) + ((job_distance - limit d tax1)*tax2) } echo "----------> THE RESULT IS: € " . $result;