note 61020 deleted from function.round by danbrown

From: Date: Sun, 17 May 2009 16:21:40 +0000
Subject: note 61020 deleted from function.round by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154806@lists.php.net to get a copy of this message
Note Submitter: elbekko at gmail dot com ---- I created a round down function, pretty basic but it should work :P <?php function round_down($value) { if(is_float($value)) { $exploded = explode(".",$value); return $exploded[0]; } else { die("Only float values can be entered."); } } ?> You could use the same function for rounding up: <?php function round_up($value) { if(is_float($value)) { $exploded = explode(".",$value); return $exploded[0] + 1; } else { die("Only float values can be entered."); } } ?>

« previous php.notes (#154806) next »