note 26680 added to ref.math

From: Date: Fri, 08 Nov 2002 19:15:03 +0000
Subject: note 26680 added to ref.math
Groups: php.notes 
Request: Send a blank email to php-notes+get-39192@lists.php.net to get a copy of this message
I was looking for a truncate function. Not finding one, I wrote my own. Since it deals with everything as a number, I imagine it's faster than the alternative of using string functions. HTH... function truncate ($num, $digits = 0) { //provide the real number, and the number of //digits right of the decimal you want to keep. $shift = pow(10, $digits); return ((floor($num * $shift)) / $shift); } -- http://www.php.net/manual/en/ref.math.php http://master.php.net/manage/user-notes.php?action=edit+26680 http://master.php.net/manage/user-notes.php?action=delete+26680 http://master.php.net/manage/user-notes.php?action=reject+26680

« previous php.notes (#39192) next »