Yeah, sometimes this is an annoying problem with PHP. Somehow, "",
null, 0 and "0" is the same thing. The last two are considered empty()
too.
-William
El mi? 07-04-2004 a las 16:34, Red Wingate escribi�:
> JFYI :
>
> var_dump ( '' == 0 ) eq TRUE
>
> William Lovaton wrote:
>
> > I don't think so,
> >
> > Wouldn't be better if ctype_digit() return false on an empty string??
> > any way an empty string is not a digit.
> >
> > This change will brake backward compatibility so it is not an option.
> >
> > if you look carefully the function that you propose is doing two things
> > at once... at this level this is not a good idea.
> >
> >
> > -William
> >
> >
> > El mi? 07-04-2004 a las 12:39, Red Wingate escribi�:
> >
> >>No, as this would be yet another line of source. Maybe get those guys
> >>to add another function
> >>
> >>ctype_digit_and_not_empty();
> >>
> >> -- red
> >>
> >>[...]
> >>
> >>>>* Thus wrote William Lovaton ([EMAIL PROTECTED]):
> >>>>
> >>>>>or modify is_numeric() to explictly perform an integer validation:
> >>>>>is_numeric(mixed value [, bool is_integer = false])
> >>>>
> >>>>um.. ctype_digit().
> >>>
> >>>Very nice! it works fine. The only issue is that it will return true if
> >>>the parameter is an empty string (""). Nothing that an empty() can't
> >>>fix.
> >>
> >>[...]
> >
> >
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php