...

View Full Version : php regex and number formatting



bcarl314
06-18-2002, 01:03 PM
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.

whackaxe
06-18-2002, 07:26 PM
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

Jeewhizz
06-18-2002, 08:56 PM
check out

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

Jee



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum