|
|
|
| Title : |
Check int / integer - checking if a variable is an integer or not. The php is_int() function does not check if the string value is integer or not. |
| Categories : |
PHP, Variables |
 Yared g |
| Date : |
Oct 12th 2000 |
| Grade : |
3 of 5 (graded 5 times) |
| Viewed : |
12748 |
| File : |
No file for this code example. |
| Images : |
No Images for this code example. |
|
| Search : |
More code by Yared g |
|
| Action : |
Grade This Code Example
|
|
| Tools : |
My Examples List |
|
|
|
|
|
|
function check_int($i) {
// return 0 if not int and return 1 if $i is int
if (ereg("^[0-9]+[.]?[0-9]*$", $i, $p)) {
return 1;
} else {
return 0;
}// end if
}// end check_int |
|
| clearing variables in php3 Categories : Variables, Arrays, PHP | | | Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET Categories : Algorithms, HTML and PHP, PHP, Variables | | | A simple function to prevent undefined $_POST/$_GET/$_SESSION variable errors Categories : PHP, Variables, Errors and Logging | | | This functions compares the current PHP version with a
desired version. Because of the 3 tiered version system, a
direct compare of a string to phpversion() will not be
accurate. Categories : PHP Configuration, PHP, Variables | | | How to control the number of decimal places when outputting numbers. Categories : PHP, Strings, Variables | | | Functions to read a template file and fill in PHP variables. It will also fill in array variables, displaying parts of the template multiple times.
Categories : PHP, Variables, Filesystem | | | Newbie Notes #5 - To double quote, or single quote, that is the question Categories : PHP, Beginner Guides, Variables | | | A quick way set data from a form to a function or other places where you can lose scope. Categories : PHP, HTML and PHP, Variables | | | Display variables when a form is submitted using POST/GET Categories : PHP, Functions, Variables, Debugging | | | Accessing GET and PUT variables with HTTP_GET_VARS on Win2K. Categories : PHP, Windows 2000, Variables | | | Pageinfo: Array containing page URI, page query string (parameters), request method (GET or POST) and the complete URI Categories : Variables, PHP Options and Info, Arrays, URLs, PHP | | | How to implement a session tracking system. Categories : PHP, Sessions, Variables | | | serialize -- Generates a storable representation of a value Categories : PHP, PHP Functions, Variables | | | Variable serialization and unserialization. Loading and saving variable structures
to and from file. Categories : Arrays, Filesystem, Variables, Strings, PHP | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | |
| | | | Shashank Tripathi wrote :1699
Just use the is_numeric() function. The function that the other poster has suggested is highly inefficient. The POSIX "eregi" library functions are much poorer performers than their "preg_" equivalents, but for your purpose you don`t need any regex at all.
| |
|
|
|