note 105790 modified in function.round by danbrown

From: Date: Thu, 15 Sep 2011 17:08:43 +0000
Subject: note 105790 modified in function.round by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-183197@lists.php.net to get a copy of this message
this function (as all mathematical operators) takes care of the setlocale setting, resulting in some weirdness when using the result where the english math notation is expected, as the printout of the result in a width: style attribute! <?php $a=3/4; echo round($a, 2); // 0.75 setlocale(LC_ALL, 'it_IT@euro', 'it_IT', 'it'); $b=3/4; echo round($b,2); // 0,75 ?> --was-- this function (as all mathematical operators) takes care of the setlocale setting, resulting in some weirdness when using the result where the english math notation is expected, as the printout of the result in a width: style attribute! $a=3/4; echo round($a, 2); // 0.75 setlocale(LC_ALL, 'it_IT@euro', 'it_IT', 'it'); $b=3/4; echo round($b,2); // 0,75 http://php.net/manual/en/function.round.php

« previous php.notes (#183197) next »