Reply to Re: round number to the nearest...

Your name:

Reply:


Posted by Krustov on 08/28/07 22:54

<comp.lang.php>
<>
<Mon, 27 Aug 2007 18:57:37 -0700>
<1188266257.277944.233110@o80g2000hse.googlegroups.com>

> > if ($dwarfs==0) {$poop=0;}
> > if ($dwarfs==1) {$poop=0;}
> > if ($dwarfs==2) {$poop=0;}
> > if ($dwarfs==3) {$poop=5;}
> > if ($dwarfs==4) {$poop=5;}
> > if ($dwarfs==5) {$poop=5;}
> > if ($dwarfs==6) {$poop=5;}
> > if ($dwarfs==7) {$poop=0;}
> > if ($dwarfs==8) {$poop=0;}
> > if ($dwarfs==9) {$poop=0;}
> >
> > $albundy=$snowwhite . $poop;
> > print "albundy = $albundy <br><br>";
> >
> > }
> >
> > ?>
> >
> > --
> > (c) The Amazing Krustov
>
> Krustov,
>
> I am loving the script but I think I will have to work on the $poop a
> bit. lol, When I get to a situation where the 1st digit after the
> decimal needs to be rounded up, it still rounds down. This adds even
> more diffuculty to it when I have a number like 5.98 as the entire
> number will round to 6.00. Thanks for the help!
>

Dont you mean it will round down to 5.90 ? .


if ($dwarfs==7) {$poop="plop";}
if ($dwarfs==8) {$poop="plop";}
if ($dwarfs==9) {$poop="plop";}

if ($poop=="0")
{
$albundy=$snowwhite . $poop;
print "albundy = $albundy <br><br>";
}

if ($poop=="5")
{
$albundy=$snowwhite . $poop;
print "albundy = $albundy <br><br>";
}

if ($poop=="plop")
{
$albundy=$snowwhite . "0";
$albundy=$albundy+0.10;
print "albundy = $albundy <br><br>";
}

Havent tested the +0.10 and it probably wont work .


--
(c) The Amazing Krustov

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация