Re: Why doesn't working with array's ever stick in my thick head?
| From: | Roberto Mansfield | Date: | Fri, 09 May 2008 20:20:03 +0000 |
| Subject: | Re: Why doesn't working with array's ever stick in my thick head? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-274101@lists.php.net to get a copy of this message | ||
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