note 31610 deleted from function.round by sp

From: Date: Fri, 08 Aug 2003 05:14:38 +0000
Subject: note 31610 deleted from function.round by sp
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53615@lists.php.net to get a copy of this message
Note Submitter: hlang@systematrix.net ---- The following function is good when rounding off prices where for consistancy 2 digits should be enforced after the comma. It checks whether there are no or just one digit after the comma and adds "0"s accordingly. function rounder($in) { $in = round($in,2); if (substr($in,-3,1)==".") {$out=$in;} else { if (!strstr($in,".")) $out = $in.".00"; if (strstr($in,".")) $out = $in."0";} return $out; }

« previous php.notes (#53615) next »