Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    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

    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.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    paris, france
    Posts
    1,216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •