You are here: Re: percentages in PHP « All PHP « IT news, forums, messages
Re: percentages in PHP

Posted by Kim Andrι Akerψ on 04/06/06 13:56

Chris H wrote:

> "Michael Pichler" <mail@michaelpichler.de> wrote in message
> news:e102a4$pci$01$1@news.t-online.com...
> > Chris H schrieb:
> > [...]
> > > in other words what is the correct format for this type of
> > > equation.
> > >
> > > $prize_pool = "5000";
> > > $total_points = 70% of $prize_pool
> >
> > I'm not sure if I understood your problem.
> >
> > <?
> > $total_points = (int) $prize_pool * 0.7;
> > // if needed
> > $total_points = round($total_points);
> > ?>
> >
> > Can it be that simple?
> >
> What does (int) do? I recognize it as something to do with "integer".
> but im not sure what exactly the purpose is of the (int) is
>
> <?
> $total_points = (int) $prize_pool * 0.7;
> // if needed
> $total_points = round($total_points);
> ?>

It converts the resulting float to an integer:
http://php.net/language.types.integer#language.types.integer.casting

--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

 

Navigation:

[Reply to this 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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация