|
|
|
| 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 6 times) |
| Viewed : |
26119 |
| 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 |
|
| Passing variables by reference. Categories : Variables, PHP | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | PHP Dump in html format the contents of one array variable with a recursive list of the nested array variables inside. Categories : PHP, Arrays, Variables | | | Initialize global variables for every field in a table.
This version requires that phplib is installed on your
server. Categories : Global Variables, MySQL, PHP, Variables | | | A class to put get and post variables in hidden form
elements. Works on scalars, normal arrays, associative
arrays. Categories : Algorithms, Variables, Arrays, PHP, PHP Classes | | | How to display a PHP variable value from a selectbox without reloading the
page by merging PHP and Javascript variables. Categories : PHP, Java Script, Variables | | | How to pass an array to a function, or how to define a
function wich recieves an array. Categories : Variables, PHP, Arrays | | | Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
Categories : PHP, Directories, Variables, Arrays | | | Working with files - return an array of files within a directory Categories : PHP, Strings, Variables, Filesystem | | | Working with files - putting file contents to a string / var Categories : PHP, Filesystem, Variables, Strings | | | How to make sure a that $foo is from a cookie and not from the URI. Categories : PHP, Variables, Global Variables, Cookies | | | Inline Scope Control - The inline class provides methods for creating and destroying local variable scopes. Simply put, local scopes are spaces where some or all of the global variables are temporarily hidden. Categories : PHP, PHP Classes, Variables | | | A simple function to prevent undefined $_POST/$_GET/$_SESSION variable errors Categories : PHP, Variables, Errors and Logging | | | Accessing GET and PUT variables with HTTP_GET_VARS on Win2K. Categories : PHP, Windows 2000, Variables | | | Make your PHP 4.1 (or higher) script compatible with PHP 4.0 (still used by some prviders) Categories : PHP, PHP Options and Info, Variables | |
| |
| | | | | 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.
| |
|
|