Re: Fractions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)] . "&quot";

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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux