Jump to content

Archived

This topic is now archived and is closed to further replies.

komquat

Format a number

Recommended Posts

I need help formatting a number to a set decimal place.

Please help

Thanks in advance

Share this post


Link to post
Share on other sites
[code]<?php

$number = 1234.56;

$a = number_format($number, 2, '.', ',');

$b = number_format($number, 3, '.', ',');

echo "$a<br><br>$b";

?>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.