Re: Removing non-numbers
| From: | Richard Lynch | Date: | Tue, 15 Feb 2005 20:33:08 +0000 |
| Subject: | Re: Removing non-numbers | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-208775@lists.php.net to get a copy of this message | ||
Ben Miller wrote:
> OK - easy one here, I know. Having troubles removing anything that is not
> a
> number from user input. According to manual, [!] is supposed to mean set
> of
> non-matching optional characters. Tried
! means that, but only in a completely different context from what you are
using...
> $var = ereg_replace("[!0-9]","",$var);
$var = ereg_replace("[^0-9]", "", $var);
> and it removes the numbers, but so does
>
> $var = ereg_replace("[0-9]","",$var);
What you had was stripping OUT the digits. Plus taking out "!" in the
first one.
--
Like Music?
http://l-i-e.com/artists.htm