note 61020 added to function.round

From: Date: Mon, 23 Jan 2006 21:45:29 +0000
Subject: note 61020 added to function.round
Groups: php.notes 
Request: Send a blank email to php-notes+get-102309@lists.php.net to get a copy of this message
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."); } } ?> ---- Server IP: 193.190.198.20 Probable Submitter: 217.136.108.48 ---- Manual Page -- http://www.php.net/manual/en/function.round.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61020 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61020&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61020&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61020&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61020&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61020&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61020&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61020&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61020&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102309) next »