Home  |  Linux  | Mysql  | PHP  | XML
From:Roberto Mansfield Date:Fri May  9 14:20:03 2008
Subject:Re: Why doesn't working with array's ever stick in my thick
head?
Jason Pruim wrote:
>> Why do you want tenth's of pounds? Just divide pounds by 16 and you'll
>> get ounces.
> 
> It's actually for a weight calculator that we use for some of our
> mailings. when you take .226 and multiply that by 464 you get 104.864
> ounces.
> 
> I need to be able to display that as: 6 # 13.824 Ounces.

Then I think you want to use the mod operator:

(I'm assuming .226 is the cost per ounce and 464 is the total number of
ounces)

$pounds = intval( .226 * 464 / 16 );
$ounces = ( .226 * 464 ) % 16;


Roberto
Navigate in group php.general at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants