Search code examples
phpfloating-pointdecimal-point

I need comma in between figures in php


I don't know how to display my numbers to have commas and a decimal point in php..

I want 12345.90 to be displayed as 12,345.90

thanks in advance


Solution

  • You should check out number_format function. It will solve your problem.

    Try this:

    echo number_format(12345.90, 2, '.', ','); // Prints 12,345.90