Add commas to a digit

I have a number : 150000 where the last two digit are the decimals, I need to add a comma before the last two digit to show the correct amount as follow 1500.00
Who is Participating?
richdiesalConnect With a Mentor ProfessorCommented:
What about just using:

$number = $number / 100;

You can then display the number, forcing 2 decimal places, using:

printf("%0.2f", $number);
steelseth12Connect With a Mentor Commented:
$number = 150000;
print number_format($number/100, 2, ',', '');
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.