title: Convert Days to Year,Month,Day Format
body: <p>I have this problem. Can someone help me,how to convert number of days into the format XX Years, XX Month, XX Days...
  i created this function, </p>
  
  <pre><code>function convert($sum) {
      $years = ($sum / 365) ;
      $years = floor($years); 
      $month = ($sum % 365) / 30.5; 
      $month = floor($month); 
      $days = ($sum % 365) % 30.5; // the rest of days
      // Echo all information set
      echo 'DAYS RECEIVE : '.$sum.' days&lt;br&gt;';
      echo $years.' years - '.$month.' month - '.$days.' days';
  }
  
  convert(151);
  </code></pre>
  
  <p>But with <strong>151</strong> days  the result was wrong</p>
  
  <blockquote>
    <p>DAYS RECEIVE : 151 days<br>0 years - 4 month - 1 days</p>
  </blockquote>
  
  <p>it must be 4 month ans 28 days not 1 day...</p>
  
  <p><a href="http://sandbox.onlinephpfunctions.com/code/f5e6b4b4f6a27024b66ffbf04e80698722a3ecab" rel="nofollow noreferrer">http://sandbox.onlinephpfunctions.com/code/f5e6b4b4f6a27024b66ffbf04e80698722a3ecab</a></p>