Hello,
"Ernest E Vogelsinger" <[EMAIL PROTECTED]> wrote:
> At 23:53 14.11.2002, Lars Espelid said:
> --------------------[snip]--------------------
> >Try to execute this code:
> >if (ereg[^0-9], $num))
> > print "That's not a number!";
> >
> >result: parsing error, expects ')' on the if-line.
>
> You forgot an opening bracket, and need to quote the regex, like
> if (ereg('[^0-9]', $num))
> print "That's not a number!";
>
I think I'm missing something here but while the regex might be correct,
don't you think the "print ..." part is incorrect?
I mean, _negative_ numbers are numbers, no?
Wouldn't it be better just to use is_int() or is_numeric()?
- E
...[snip]...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php