note 493 modified in setlocale by ronabop

From: Date: Fri, 24 Nov 2000 06:02:17 +0000
Subject: note 493 modified in setlocale by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-8050@lists.php.net to get a copy of this message
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). http://www.php.net/manual/function.setlocale.php

« previous php.notes (#8050) next »