str_pad with a float in php?
<p>I am looking for the best way to <code>str_pad</code> floats in php.</p>

<p>The problem I am having is that <code>str_pad</code> takes into account the string length but with a float there is the decimal point. If I want a number padded with zeros this becomes a little bit of a nightmare.</p>

<p>For example if I need the number to always have at least 6 numbers after the decimal point I cannot do it with <code>str_pad</code> as the results change.</p>

<pre><code>$i = 1.0;
echo str_pad($i, 8, '0'); // 1.000000
$i = 10.5
echo str_pad($i, 8, '0'); // 10.50000 ## ONLY PADDED WITH 5 NUMBERS AFTER DECIMAL
</code></pre>

<p>I know I can <code>explode</code> then <code>str_pad</code> and do it that way but just wondered if there was a php built in function for this or any better ways.</p>
