List Info

Thread: note 78414 added to function.round




note 78414 added to function.round
user name
2007-10-10 23:41:40
my round function
function rounding($n,$d){
	$base=intval($n);
	$n=number_format($n,25);
	$dotpos=strpos($n,".");
	$strlen=strlen($n);
	$b= substr($n,$dotpos+1,$strlen-$dotpos);
	$j=1;
	$p=0;
	for($i=strlen($b);$i>$d;$i--){
	            $c=substr($b,-$j,1)+$p;
		if($c<5){
			$p=0;
		}else{
			$p=1;
		}
		$j++;
	}
 return $base+((substr($b,0,$d)+$p)/pow(10,$d));
}
----
Server IP: 203.121.145.116
Probable Submitter: 203.156.178.233
----
Manual Page -- http:
//www.php.net/manual/en/function.round.php
Edit        -- https://master
.php.net/note/edit/78414
Del: integrated  -- h
ttps://master.php.net/note/delete/78414/integrated
Del: useless     -- http
s://master.php.net/note/delete/78414/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/78414/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/78414/spam
Del: non-english -- 
https://master.php.net/note/delete/78414/non-english
Del: in docs     -- http
s://master.php.net/note/delete/78414/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78414
Reject      -- https://mast
er.php.net/note/reject/78414
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )