Helpful Information
 
 
Category: PHP
php regex and number formatting

I've got 2 quick quesitons on php.

1) I'm guessing php has regex functionallity, how do I do a replace in php? (ie replace all occurances of a "," with a space)

2) How do I make sure a number is in decimal format to 1/100ths? (ie 99.5 changes to 99.50, and 45.67312 changes to 45.67) and how do you round in php?

Thanks.

str_replace("what_you_want_to_replace","replace_by",$string);

that should nicely! but for the numbers i cant help. you should get the PHP manual and have a look in that

-the whacakaxe

check out

www.php.net/number_format
and
www.php.net/round

Jee










privacy (GDPR)