ctype_digit() - 语法
ctype_digit ( $text );
它检查提供的字符串text中的所有字符是否都是数字的。它只检查1.9
| Sr.No | Parameter & Description |
|---|---|
| 1 |
text(必需) 匹配字符串。 |
ctype_digit() - 返回值
如果文本中的每个字符都是十进制数字,则返回TRUE,否则返回FALSE。
ctype_digit() - 示例
<?php $strings=array(122.50, 1004, foo!#); foreach ($strings as $test) { if (ctype_digit($test)) { echo "$test consists of all digits.\n"; }else { echo "$test does not have all digits.\n"; } } ?>
这将产生以下结果-
122.50 does not have all digits 1004 consists of all digits foo!#$bar does not have all digits