Removing commas from number
| From: | Todd Cary | Date: | Sun, 06 May 2007 15:33:17 +0000 |
| Subject: | Removing commas from number | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-254486@lists.php.net to get a copy of this message | ||
Thanks to the suggestions, I use number_format($my_number, 2) to format the number in an edit field. Now I need to reenter it into MySQL. How should I use preg_replace to remove the commas?
This removes the commas *and* the decimal point:
preg_replace('/\D/', '', $str)
In reviewing patterns, I cannot find the purpose of the "/" character in the above.
Many thanks....
Todd