Extracting Numbers from a string.
| From: | Jason Caldwell | Date: | Wed, 11 Sep 2002 22:31:22 +0000 |
| Subject: | Extracting Numbers from a string. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-116051@lists.php.net to get a copy of this message | ||
I need to extract the numbers only from a field.
For example: I have an AMOUNT field and so that I can filter out any user
typo's I would like to extract the numbers only.
If the user enters $56.55 for example or just $56 then I would like to be
able to remove the "$" and the "." keeping just the 56 or 5655.
Can I use eregi_replace() to do this -- I've been trying but it doesn't seem
to work right.
Thanks.
Jason