I have a php script that prints out a floating point value that I would like to format with three positions after the decimal point, but no leading zero.
So I'd like a combination of printf ("%0.3f",$var) and ltrim($var,0), but printf ("%0.3f",ltrim($var,0)) seems to ignore the 'ltrim' part.
So for $var = 1, I'd like to output 1.000, for $var = 1/2 -> .500, $var = 1/3 -> .333, etc. Thanks!
So I'd like a combination of printf ("%0.3f",$var) and ltrim($var,0), but printf ("%0.3f",ltrim($var,0)) seems to ignore the 'ltrim' part.
So for $var = 1, I'd like to output 1.000, for $var = 1/2 -> .500, $var = 1/3 -> .333, etc. Thanks!