Php trip cost calculator

I follow an php trip cost calculator and teh author put for fuel efficiency the values 10, 20, 30, 50
I am not from US and I don’t know how how he got to those values. Are those representing some how the fuel in US? Or this calculator is very far away from reality?

This is the form where he uses that:

<?php
// Calculate the results:
        $gallons = $_POST['distance'] / $_POST['efficiency'];
        $dollars = $gallons * $_POST['gallon_price'];
        $hours = $_POST['distance']/65;
?>

<h1>Trip Cost Calculator</h1>
<form action="calculator.php" method="post">
    <p>Distance (in miles): <input type="text" name="distance" /></p>
    <p>Ave. Price Per Gallon: <span class="input">
    <input type="radio" name="gallon_price" value="3.00" /> 3.00
    <input type="radio" name="gallon_price" value="3.50" /> 3.50
    <input type="radio" name="gallon_price" value="4.00" /> 4.00
    </span></p>
    <p>Fuel Efficiency: <select name="efficiency">
    <option value="10">Terrible</option>
    <option value="20">Decent</option>
     <option value="30">Very Good</option>
    <option value="50">Outstanding</option>
    </select></p>
     <p><input type="submit" name="submit" value="Calculate!" /></p>
</form>

Looks like it’s for entertainment or example purpose only, or a very rough estimate at best.
i.e. How precise are “decent”, “very good” etc?
That and prices to only the nearest half dollar.

I assumed that is not close to reality because he doesn’t explain how he got to those values. Thank you.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.