[Solved] PHP – Re-format number with commas


Your original number is treated as a string because of the commas. So at minimum you need to remove them before calling intval() which will truncate off the decimal:

<?php
$num = '4,063,500.00';
echo intval(str_replace(',', '', $num));

And the output is:

4063500

4

solved PHP – Re-format number with commas