PHP 教程
is_numeric() 函數(shù)用于檢測變量是否為數(shù)字或數(shù)字字符串。
PHP 版本要求:PHP 4, PHP 5, PHP 7
bool is_numeric ( mixed $var )
參數(shù)說明:
如果指定的變量是數(shù)字和數(shù)字字符串則返回 TRUE,否則返回 FALSE。
輸出結(jié)果為:
678 是數(shù)字 a678 不是數(shù)字 bool(true) [ 678 是數(shù)字嗎? ] bool(false) [ json.cn 是數(shù)字嗎? ] bool(true) [ 698.99 是數(shù)字嗎? ] bool(false) [ Array 是數(shù)字嗎? ] bool(true) [ 125689.66 是數(shù)字嗎? ]其他擴(kuò)展