note 35050 added to function.round

From: Date: Mon, 18 Aug 2003 02:58:02 +0000
Subject: note 35050 added to function.round
Groups: php.notes 
Request: Send a blank email to php-notes+get-54549@lists.php.net to get a copy of this message
Here is how to always round up... $x = (a/b); $r = round($x); $d = ($x-$r); if ($d>0){ $x = ($r+1); } I had to use this for a directory page list I.E: "1 - 2 - 3 - 4 - 5 - NEXT >" where people search 20 things per page and it was not showing me the last page since it had less than 20 things... a equaled the number of rows in a mysql table b equaled the amount of things i want the user to see per page x is used to add the "1 - 2 - 3 - 4 - 5 - NEXT>" using a loop. Hope this helps someone. http://www.limit0.com/games/files/gamelist.php is the file it was for. ---- Manual Page -- http://www.php.net/manual/en/function.round.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35050 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35050&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35050&report=yes

« previous php.notes (#54549) next »