![]() |
|
|
+ Search |
![]()
|
May 30th, 2001 15:27
Philip Olson, Onno Benschop, Nathan Wallace,
You can test to see if there are only numbers using the very useful
is_numeric function :
if (is_numeric($data)) {
print 'this is numeric alright!' ;
}
If you're running PHP3 then using is_numeric is not an option, consider
using some regex instead. For example :
if (ereg("[^[:digit:]]", $data)) {
print 'contains illegal characters!' ;
}
References :
http://www.php.net/manual/function.is-numeric.php
http://www.php.net/manual/function.ereg.php