Mark Kelly wrote:
Hi.
On Sunday 24 May 2009, Ron Piggott wrote:
Is there a way to remove the trailing '0'?
$width = number_format($width,2);
Also is there a way to have the original fraction display (1/4), as well
as have provision for 1/8 and 3/8 and 1/2, etc. display?
On this one I suspect you'd have to write your own function, but maybe
someone else knows better.
yup you need to write your own functions - there was a request to
internals a year or two ago, and it was decided that fractions were so
easy to implement in userland and so rare that people should just
implement them with there own code.
not expressly hard
echo '1/' . (1/0.25);
should be 1/4 i do believe
or in this scenario
$val = (float)'6.250';
$fract = $val - floor($val);
echo '1/' . (1/$fract);
the above code really won't do for 3/8's or suchlike though just a quick
pointer - from here on your in userland :p
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php