PHP Salt


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

Version: 2.20.2
Last Build: October 16, 2017 12:40pm (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
file
graph
html
mail
math
misc
mobile
script
string
system
time
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