Hi
Newbie here - but loving learning php. Most questions I've managed to answer from forums but this one I'm stuck on - sorry if its so easy to be annoying.
How do I convert a string that is in currency format e.g. £40,995 to 40995 i.e. a numeric ,so I can do arithmatic on it?
Thanks
How do I convert £40,995 to 40995
Moderator: General Moderators
-
chopschops
- Forum Newbie
- Posts: 2
- Joined: Mon Jul 23, 2007 10:42 am
- stereofrog
- Forum Contributor
- Posts: 386
- Joined: Mon Dec 04, 2006 6:10 am
try
Code: Select all
preg_replace('/\D+/', '', $value);-
chopschops
- Forum Newbie
- Posts: 2
- Joined: Mon Jul 23, 2007 10:42 am
Works perfectly
Excellent - thanks for the quick response!