note 43864 deleted from function.round by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 16:23:44 +0000 |
| Subject: | note 43864 deleted from function.round by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154817@lists.php.net to get a copy of this message | ||
Note Submitter: Dan
----
a simpler solution to the 'round to a half' method suggested by monte at ispi dot net,
below. This version returna the actual number.
<?php
$actual_value = 3.45; // 3.45
$temp1 = $actual_value * 2; // 6.9
$temp2 = round($actual_value, 0); // 7
$half_round = $temp2 / 2 // 3.5
?>