Re: Fractions
| From: | Ron Piggott | Date: | Mon, 25 May 2009 01:24:58 +0000 |
| Subject: | Re: Fractions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-293094@lists.php.net to get a copy of this message | ||
This is what I came up with, it may help some of you working with US
measurements.
$interval = array(0.125 => '1/8', 0.25 => '1/4', 0.375 =>
'3/8', 0.5 =>
'1/2', 0.625 => '5/8', 0.75 => '3/4', 0.875 =>
'7/8');
echo "Width: " . intval($product_width_inch) . " " .
$interval[$product_width_inch-intval($product_width_inch)] . "" x
Height: " . intval($product_height_inch) . " " .
$interval[$product_height_inch-intval($product_height_inch)] . """;
On Sun, 2009-05-24 at 18:03 -0400, Ron Piggott wrote:
>
> Is there a way to remove the trailing '0'?
>
> 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?
>
> Width: 2.250" x Height: 6.250"
>
> Ron