Any idea how I do this??? Thnx...
HELP -> Change 2,500,000.40 to 2500000.00
Moderator: General Moderators
HELP -> Change 2,500,000.40 to 2500000.00
How do i change this variable to 2 decimals??? 2,500,010.40 -> 2500010.40
Any idea how I do this??? Thnx...
Any idea how I do this??? Thnx...
Re: HELP -> Change 2,500,000.40 to 2500000.00
pido wrote:How do i change this variable to 2 decimals??? 2,500,010.40 -> 2500010.40
Any idea how I do this??? Thnx...
The number is already two decimals. Do you mean remove the commas?
check out number_format()
It seems like he just wants to get rid of the commata.
Code: Select all
$teh_numbar = '2,500,010.40';
$teh_numbar = round(floatval((str_replace(',', '', $teh_numbar))), 2);Code: Select all
$myNumber = '2,500,010.40';
$result = str_replace(',', '', $myNumber);