PHP Salt


A little dash of PHP... my collection of php functions

Version: 2.14.1
Last Build: March 10, 2017 13:28pm (PST)

psMoneySimple()
Returns money in a simple format


Description:

This returns a string representing money, and returns it in a simple format
Format: 9,999.99



Usage:

$str = psMoneySimple($numString)


Example:


$str = psMoneySimple("$ 5,232.12"); // returns "5,232.12"




Code:


function psMoneySimple($m)
{
$m = trim($m);
$m = str_replace(",","",$m);
$m = str_replace("\$","",$m);
$m = number_format($m,2);
return $m;
}


Changlelog:


See Also

And a shot out to:

LinuxSimple - www.linuxsimple.com
PHP - php.net
Fedora Server - getfedora.com
Shameless ads to pay for site