Library code snippets
Determine if a variable is numeric
By James Crowley, published on 28 Sep 2001
There are a number of ways to determine if a variable in PHP
is numeric. If you have PHP 4, you can use the is_numeric function:if (is_numeric($thefield)==false) {
echo "\$thefield is not a number";
}
If you have PHP 3, then you can use the following function
function is_numeric($value) {
if (((int) $value)== $value) {
return true;
} else {
return false;
}
}
Related articles
Related discussion
-
Is it possible to send SMS using PHP or java or VB,j2ee?
by shwetak (1 replies)
-
Beginning from scratch
by Slicksim (1 replies)
-
How to modularize CSS menus
by Slicksim (2 replies)
-
What technology / Framework would you propose
by James Crowley (2 replies)
-
ASP VS PHP
by paulfp (9 replies)
Related podcasts
-
Java Posse #212 - Oracle Developer Tools Interview
Interview with Ted Farrell about Oracle Developer Tools Fully formatted shownotes can always be found at http://javaposse.com We talk to Ted Farrell (and at the end Duncan Mills) about the Oracle Java developer tools, the new Oracle 11g product stack, Oracle's work on JSRs, the future of the ...
Related jobs
-
Open Source Stack Application Server Administrator
in Luxemburg (€35K-€55K per annum) -
PHP Developer - Germany
in Koln (€35K-€60K per annum) -
Solutions Engineer
in Reading (£50K-£60K per annum) -
Senior Web Developer - Luxembourg
in Luxembourg (€45K-€70K per annum)
This thread is for discussions of Determine if a variable is numeric.