You are here: Re: number_format() question EASY « PHP Programming Language « IT news, forums, messages
Re: number_format() question EASY

Posted by Johannes Vogel on 02/22/07 10:36

Hi

Anonymous wrote:
> Jerry Stuckle wrote:
>> $num = int($num);
> I would advise against type casting. It can produce strage results under
> some circumstances.
> He would be better of using $num = floor($num), that's what the function
> is here for.
> ceil() always rounds up, floor() always rounds down, round() rounds
> according to mathematical rules (down on .0 to .4, up on .5 to .9

What's about minus values?
We don't know what the OP would like to get.

floor(-2.8) => -3
(int)-2.8 => -2

HTH, Johannes

 

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

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