I am trying to calculate fare based on kilometers, for example minimum fare is 20 for 2km or below and if 2.1km fare should be 20.5 or if 3km fare is 25. how to achieve this problem?

My current code below is converted kilometers to meters. missing part is if 2.1km and above.

Do I need my base is 0.05?

$distance_km = 3; echo calculateFare(kilometersToMeters($distance_km)); function calculateFare($distance) { if ($distance < 2000 or $distance <= 2000) { return $cost = 20; } else { // no answer here } } function kilometersToMeters($km){ return $km * 1000; }

Thanks!