|
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]
|