K. Doe K. Doe - 2 years ago 127
PHP Question

Converting number-formatted variable back to original format - PHP

I used number_format in a number. I want to know how to convert number-formatted variable in php back to its original format

I first used number_format. And I want to echo back its original format removing the number format.

$number = 500000
echo number_format($number, 2);

Answer Source
$number = 500000;
$formattedNumber = number_format($number, 2);
$getBackOriginl = explode('.',$formattedNumber);
echo str_replace(',','',$getBackOriginl[0]);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download