PHP Salt


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

Version: 2.25.1
Last Build: July 17, 2019 09:07am (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
db
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:

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