[Php-it] Intercettare array GET
Cesare D'Amico
cesare at ngi.it
Sat Aug 12 14:26:33 CEST 2006
Alle 11:52, sabato 12 agosto 2006, Tassoman (mailing) ha scritto:
> Jonathan Stoppani ha scritto in data 12/08/2006 10:52 :
> > is_numeric controlla anche le stringhe:
> >
> > is_numeric -- Finds whether a variable is a number or a numeric
> > string (http://ch2.php.net/is_numeric)
>
> Quel che intendo io è controllare se id è un intero. Mi pare che
> is_numeric ti torna vero anche se ci metti AF come stringa, che è un
> numero esadecimale.
Nì:
$ php -r 'var_dump(is_numeric("AF"));'
bool(false)
Invece:
$ php -r 'var_dump(is_numeric("0xAF"));'
bool(false)
Ma esiste anche ctype_digit:
$ php -r 'var_dump(ctype_digit("12"));'
bool(true)
$ php -r 'var_dump(ctype_digit("0xAF"));'
bool(false)
Maggiori info su http://it.php.net/ctype_digit
Ciaps
ce
--
Cesare D'Amico | Gruppo Volta
Area tecnica | Web & Mkt Solutions
Tel: 045 21 000 84 | Via Leida 8 - Verona
Fax: 045 21 000 85 | http://www.gruppovolta.it
More information about the Php-it
mailing list