note 24377 deleted from function.round by didou

From: Date: Wed, 17 Sep 2003 01:02:00 +0000
Subject: note 24377 deleted from function.round by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-56600@lists.php.net to get a copy of this message
Note Submitter: vui@gmx.net ---- an easier way of getting 0.05 increments for currencies, f.e. swiss francs: function chf($a) { $tmp = (100*round($a, 2)) % 5; if ($tmp == 0) return $a; else if ($tmp <= 2) return ($a - $tmp/100); else return ($a + (5-$tmp)/100); }

« previous php.notes (#56600) next »