Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-18-2002, 01:03 PM   PM User | #1
bcarl314
Mega-ultimate member


 
Join Date: Jun 2002
Location: Winona, MN - The land of 10,000 lakes
Posts: 1,855
Thanks: 1
Thanked 45 Times in 42 Posts
bcarl314 will become famous soon enough
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.
bcarl314 is online now   Reply With Quote
Old 06-18-2002, 07:26 PM   PM User | #2
whackaxe
Senior Coder

 
Join Date: Jun 2002
Location: paris, france
Posts: 1,216
Thanks: 0
Thanked 0 Times in 0 Posts
whackaxe is an unknown quantity at this point
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
whackaxe is offline   Reply With Quote
Old 06-18-2002, 08:56 PM   PM User | #3
Jeewhizz
Regular Coder


 
Join Date: May 2002
Location: London, England
Posts: 369
Thanks: 0
Thanked 0 Times in 0 Posts
Jeewhizz is an unknown quantity at this point
check out

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

Jee
__________________
Jeewhizz - MySQL Moderator
http://www.sitehq.co.uk
PHP and MySQL Hosting
Jeewhizz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:39 PM.


Advertisement
Log in to turn off these ads.