Re: Decimal Places
| From: | dwalker | Date: | Thu, 31 Oct 2002 02:02:13 +0000 |
| Subject: | Re: Decimal Places | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-122162@lists.php.net to get a copy of this message | ||
<?php function
DoFormatNumber($theObject,$NumDigitsAfterDecimal,$UseParensForNegativeNumber
s,$GroupDigits)
{
$currencyFormat=number_format($theObject,$NumDigitsAfterDecimal,$UseParensFo
rNegativeNumbers,$GroupDigits);
return ($currencyFormat);
}
?>
<?php echo DoFormatNumber( $Product->Fields("UnitPrice"), 2, -2, -2) ?>
-----Original Message-----
From: Andrew Wilson <will@netwaynetworks.com.au>
To: php-general@lists.php.net <php-general@lists.php.net>
Date: Tuesday, October 29, 2002 11:34 PM
Subject: [PHP] Decimal Places
>Hay guys,
>I have two variables ( integers ) that are being minused one from the other
>and i am printing the result to the screen but i am getting unwanted
>decimals.
>
>print ($eall - $sall) / 1000;
>
>My question is what is the easiest way to strip decimals off the above
>result. The only way i know around it is if i piped the above statement
into
>another varible and set that variable to an integer then printed that.
>
>I dont really want to do this as i will end up with 50 extra variables.
>Thanks in advance for your comments.
>
>Andrew Wilson
>Technical Support
>Netway Networks
>8920-8877
>
>
>Netway Networks Pty Ltd
>(T) 8920 8877
>(F) 8920 8866
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>