note 98918 modified in function.round by danbrown

From: Date: Thu, 15 Jul 2010 17:20:40 +0000
Subject: note 98918 modified in function.round by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-170891@lists.php.net to get a copy of this message
The PHP_ROUND_HALF_UP is unabled to less php 5.3, but I've a solution for this: <?php echo 252 / 40; // 6.3 ?> If I round this: <?php echo round(252 / 40); // 6 ?> But I like to enable result like PHP_ROUND_HALF_UP. I can do this: <?php echo round((252/40) + 0.5); // 7 ?> It's usefull to paginators ;) --was-- The PHP_ROUND_HALF_UP is unabled to less php 5.3, but I've a solution for this: echo 252 / 40; // 6.3 If I round this: echo round(252 / 40); // 6 But I like to enable result like PHP_ROUND_HALF_UP. I can do this: echo round((252/40) + 0.5); // 7 It's usefull to paginators ;) http://php.net/manual/en/function.round.php

« previous php.notes (#170891) next »