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?