PHP Salt


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

Version: 2.33.2
Last Build: December 29, 2023 20:28pm (PST)

Main Menu

Home

Get PHP Salt


The Functions

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