检查 PHP 中的值是否仅包含数字的最快方法? [英] Quickest way to check that a value in PHP only contains digits?

查看:21
本文介绍了检查 PHP 中的值是否仅包含数字的最快方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以用双 for 循环以痛苦的方式做到这一点,但肯定有一个内置的方法吗?将用于验证电话号码条目.

I could do this the painful way with a double for loop, but surely there's an inbuilt method? Will be used to validate phone number entries.

推荐答案

ctype_digit()

这篇关于检查 PHP 中的值是否仅包含数字的最快方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆