PHP is_numeric detects whether the variable is a number or a numeric string
Function syntax:
bool is_numeric ( mixed $var )
If var is a number or numeric string, return TRUE, otherwise return FALSE.
Example 1:
<?php $v = is_numeric ('58635272821786587286382824657568871098287278276543219876543') ? true : false; var_dump ($v); ?> The above script will output: bool(true)
Example 2:
<?php $str="0"; $strTest=is_numeric(0); var_dump($strTest); ?> boolean true
Knowledge expansion:
is_bool()
;//Determine whether it is a Boolean typeis_float()
; //Determine whether it is a floating point type is_int()
; //Judge whether it is an integer typeis_numeric()
; //Judge whether it is a numeric typeis_string()
; //Judge whether it is a numeric type Whether it is a stringis_array()
; //Judge whether it is an arrayis_object()
; //Judge whether it is an object
Recommended tutorial : PHP video tutorial
The above is the detailed content of PHP determines whether it is a numeric type. For more information, please follow other related articles on the PHP Chinese website!