RE: [PHP4BETA] is string numeric
| From: | Harold | Date: | Thu, 16 Mar 2000 10:37:52 +0000 |
| Subject: | RE: [PHP4BETA] is string numeric | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-12224@lists.php.net to get a copy of this message | ||
>LI. Variable functions
> Table of Contents
> gettype - Get the type of a variable.
> intval - Get integer value of a variable.
> doubleval - Get double value of a variable.
> empty - determine whether a variable is set
> is_array - Finds whether a variable is an array.
> is_double - Finds whether a variable is a double.
> is_float - Finds whether a variable is a float.
> is_int - Find whether a variable is an integer.
> is_integer - Find whether a variable is an integer.
> is_long - Finds whether a variable is an integer.
> is_object - Finds whether a variable is an object.
> is_real - Finds whether a variable is a real.
> is_string - Finds whether a variable is a string.
> isset - determine whether a variable is set
> settype - Set the type of a variable.
> strval - Get string value of a variable.
> unset - Unset a given variable
$a = "12345";
gettype($a); // returns string
is_integer($a); // returns false.. if $a = 12345; then it returns true..
intval($a); // returns 12345 .. not really what im after..
someone emailed me a solution with what i was looking for..
$a="12345";
if (eregi ("\D", $a)):
// not only numbers in string
else:
// only numbers in string
endif;