Could be made better? str_replace and preg_replace
Posted: Tue Jul 27, 2010 5:36 am
I use the following code to remove letters and space and replace comma with a dot
Can it done with only preg_replace? or some other call?
I do it on array 8,42 and 43
they can have the following strings:
2Â 840kr
68kr
1Â 134,00 kr
860,00 kr
Code: Select all
str_replace(',','.',preg_replace("/[^0-9,]/",'',$array[42]))
I do it on array 8,42 and 43
they can have the following strings:
2Â 840kr
68kr
1Â 134,00 kr
860,00 kr