> Well, at a guess, if a number is 0, PHP see's that as equivalent to a
> false. 

In this case, shouldn't php ignore the 0 as false?

> Also, numbers over 10 digits may be going over the limit for
> your
> PHP install, assuming PHP actually attempts to convert the string to a
> real integer for the purpose of the filter.

This happens with two different php configurations... Is it common to have this 
kind of limit on php configuration?
Is this something that I need to be aware of?

> For things this simple, 
THIS IS NOT SIMPLE !!! :) Newbie blood is in there! :p
Kidding. ;)

> I've always tended to go with something like
> this:
> if(!preg_match('^[0-9 \+]$', $telefone))
> {
>   $erros['telefone'] = 'Invalid Teléfono - Only Numbers Allowed.';
> }
> Which will check for all common types of phone numbers, including those
> where the user has put spaces in to separate groups of digits, and
> those
> that contain the + for country codes.

I will absolutely considerer the use of your regex. Thanks a lot.

Before your e-mail, I've considering the use of this:
if (!is_numeric($telefone))
  $erros['numberofsomething'] = 'Error - only numbers please.';

In the case we need to validate other ints, that are not phones for example, 
only an unlimited range of ints,
and we want to store that values on a database, should we have special 
considerations regarding the use of is_numeric ?

Thanks a lot,

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to