Tag Archives: number_format

How to display number to two decimal places in PHP

How to display number to two decimal places in PHP

To display a number with two decimal places in PHP, you can use the number_format() function. Here’s an example: In this example, we have a number $number with several decimal places. We use the number_format() function to format the number with two decimal places. The first argument is the number to be formatted, and the …