title: How to add the feet and inches to the decimal before and after code?
body: <p>I'm using the code below to convert meters to feet. It works like a charm but I would like to add inches part after the decimal point.</p>
  
  <p><strong>Present output</strong></p>
  
  <pre><code>6.2 feet
  </code></pre>
  
  <p><strong>Desired output</strong></p>
  
  <pre><code>6 feet 2 inches 
  </code></pre>
  
  <p>or </p>
  
  <pre><code>6'2"
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;?php
  $meters=$dis[height];
  $inches_per_meter = 39.3700787;
  $inches_total = round($meters * $inches_per_meter); /* round to integer */
  $feet = $inches_total / 12 ; /* assumes division truncates result; if not use floor() */
  $inches = $inches_total % 12; /* modulus */
  echo "(". round($feet,1) .")"; 
  ?&gt;
  </code></pre>