subwayman wrote:This will then handle european numbers which are of the form 100 000,00.
Except sometimes they're of the form
100.000,00
and sometimes
100,000.00
and sometimes
100.000,-
It depends pretty much on where you are and what the context is.
Just eregi'ing out the nonalpha's could leave you with a tricky problem though.
If, after the eregi, I'm left with 1000000, how do I know whether there was a decimal indicator somewhere along the way?
It takes a bit of thinking to sort out a truly generic solution to this. And you're still left with assumptions. Does 1,000 represent "one point zero zero zero" or "one thousand" it could be either.
But it can be done.
This is all getting more complicated that the original question, to which the answer is Yes, you can use str_replace to replace commas with empty strings - ie remove them.