You are here: Re: Using number_format without changing decimal « PHP Programming Language « IT news, forums, messages
Re: Using number_format without changing decimal

Posted by Alexey Kulentsov on 11/14/51 11:26

tencip wrote:
> So, I'm running data through an array, and having a little difficulty
> in using the number_format function. You see, I'm trying to get a
> comma to appear for the thousandths place, however, whenever i use the
> number_format function, it also forces rounding of the decimal.
>
> Does anyone know how I can place commas in the thousandths place
> WITHOUT doing any decimal rounding? I have some datapoints with two
> decimal places, some with four, and others with none. I don't want to
> have the function affect any of these decimal places.
>
> Any suggestions?

preg_replace('/0+$/','',number_format($number,4,'.',','))

 

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

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