10

Is there a built in function to parse an integer out of a string containing other non-numeric characters. I'm looking for JavaScript's parseInt (ish) functionality in PHP. I want to parse monetary amounts such as $100, £1000.00 or $10,000 into integers (100, 1000 and 10000 respectively). Is there a built in PHP function, or do I have to roll my own?

If I do have to write my own, is there another built in function to replace all non-numeric characters, or should I just do a regex replace?

Bojangles
  • 99,427
  • 50
  • 170
  • 208
  • 3
    try with the solution given in http://stackoverflow.com/questions/5139793/php-unformat-money/5140046#5140046. If that doesnt work google/search for a Regular Expression to do that. – Gordon Sep 13 '11 at 20:26

0 Answers0