![]() |
|
#1
|
||||
|
||||
Best way to validate numbers (ids)?I was just wondering... how do YOU validate numbers (ids) in your PHP scripts?
I used to use : PHP Code:
then I settled for : PHP Code:
now I do mostly : PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#2
|
|||
|
|||
|
is_numeric() accepts double numbers, like "-234.45e-12" for example, but your preg emulates is_int().
I suppose it's good programming practice to use intval(), but it's not necessary. If the number is put into $pgid, and a numerical operation is applied to it, it will automatically be used as a int. GF |
Recent GIDBlog
Welcome to Baghdad by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| validate form | skyloon | MySQL / PHP Forum | 3 | 15-Jul-2003 09:04 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The