note 493 deleted from function.setlocale by derick
| From: | derick@php.net | Date: | Tue, 30 Aug 2005 11:20:09 +0000 |
| Subject: | note 493 deleted from function.setlocale by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-94400@lists.php.net to get a copy of this message | ||
Note Submitter: Michal Fita <manveru at witrynka dot pl>
----
It is written nowhere, that setlocale() can be used for simple mathematical operations like adding,
substracting, dividing or multiplying. The code below gives correct results:
setlocale(LC_ALL, "pl");
$net = "1234,56";
$gross = "1,22" * $net;
printf("gross: %s, net: %s", $gross, $net");
/* Polish VAT tax is 22% */
Result of this code is:
gross: 1234,56, net: 1506,1632
So, every one can use his own decimal point for mathematical operations without any error or warning
(PHP3.0.3).