title: Taxi fare calculator with Google Maps
body: <p>I have a script for a taxi fare calculator. It calculates the costs from a destination to one end destination. The problem is that I don't know how to change the costs per km (kilometer).</p>
  
  <p>What I want is that per km the costs are 1.95 euros. And rides above the 40km 1.65 euros. The Google Maps calculates the km for the destination.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>          if (10&gt;total){
            var cost = &lt;?php echo $fix; ?&gt;;
            }
            else if (10&lt;total &amp;&amp; 20&gt;total)
              {
              var cost = ((total * &lt;?php echo $rate; ?&gt;) + (&lt;?php echo $extra; ?&gt;));
              }
              else if (20&lt;total &amp;&amp; 30&gt;total)
              {
                  var cost = ((total * &lt;?php echo $rate; ?&gt;) + (&lt;?php echo $next; ?&gt;));
              }
              else if (30&lt;total &amp;&amp; 50&gt;total)
              {
                  var cost = (((total - 30) * &lt;?php echo $cons; ?&gt;) + (&lt;?php echo $above; ?&gt;));
              }
              else
              {
                  var cost = (((total - 50) * &lt;?php echo $min; ?&gt;) + 130);
              }
  
            var fare = cost * 0.11 + cost;
            var fare = Math.round(fare*100)/100;
  </code></pre>
  
  <p>Can someone please help me?</p>