Re: [PHP-WIN] decimal numbers

2001-01-10 Thread Tom
$Percent=sprintf("%0.2f",$Percent); afan wrote: > Hi all, > short and simple question: > > >From total of 123 elements 79 are ok. What percent? > > $Total = 123; > $ok = 78; > $Percent = (100 / 123) * 78; //63.41463414... > > But I need just two decimal: 63.41 > I'm doing it this way: >

[PHP-WIN] decimal numbers

2001-01-10 Thread afan
Hi all, short and simple question: >From total of 123 elements 79 are ok. What percent? $Total = 123; $ok = 78; $Percent = (100 / 123) * 78; //63.41463414... But I need just two decimal: 63.41 I'm doing it this way: $Percent = $Percent * 10;//6341.463414... settype($Percent, "