note 68821 added to function.round
| From: | ionut dot socol at euromarket dot ro | Date: | Fri, 11 Aug 2006 22:40:51 +0000 |
| Subject: | note 68821 added to function.round | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115812@lists.php.net to get a copy of this message | ||
My name is Ionut Socol and i'm from Romania
A small script that allow you to round up, round down or just return the integer number.
The $direction value cand be:
0 - rounding down
1 - rounding up
any thing else for returning the integer value
<?php
function rounding($no,$direction)
{ $skip=0;
if(is_float($no) and $direction = 1)
{
$exploded = explode(".",$no);
$nrr = $exploded[0]+1; $skip=1;
}
if(is_float($no) and $direction = 0)
{
$exploded = explode(".",$no);
$nrr = $exploded[0]; $skip=1;
}
if(!is_float($no) and $skip ==1) { $nrr = $nrr; } else { $nrr = floor($nrr); }
return $nrr;
}
?>
----
Server IP: 212.93.155.36
Probable Submitter: 81.181.151.71
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.round.php
Edit -- https://master.php.net/note/edit/68821
Del: integrated -- https://master.php.net/note/delete/68821/integrated
Del: useless -- https://master.php.net/note/delete/68821/useless
Del: bad code -- https://master.php.net/note/delete/68821/bad+code
Del: spam -- https://master.php.net/note/delete/68821/spam
Del: non-english -- https://master.php.net/note/delete/68821/non-english
Del: in docs -- https://master.php.net/note/delete/68821/in+docs
Del: other reasons-- https://master.php.net/note/delete/68821
Reject -- https://master.php.net/note/reject/68821
Search -- https://master.php.net/manage/user-notes.php