is_numeric 检测变量是否为数字或数字字符串

bool is_numeric ( mixed $var )

如果 var 是数字和数字字符串则返回 TRUE,否则返回 FALSE

For example 1:

 
<?php
    $v = is_numeric ('58635272821786587286382824657568871098287278276543219876543') ? true : false;
    
    var_dump ($v);
?>

The above script will output:

bool(true)
 

For example 2:

<?php
$str="0";
$strTest=is_numeric(0);
var_dump($strTest);
?>
boolean true

 is_bool();//判断是否为布尔型
   is_float(); //判断是否为浮点型
   is_int(); //判断是否为整型
   is_numeric(); //判断是否为数值型
   is_string(); //判断是否为字符串
   is_array(); //判断是否为数组
   is_object(); //判断是否为对象

原文地址:https://www.cnblogs.com/741570hh/p/6844298.html