Home > php教程 > php手册 > body text

用正则表达式判断输入的数字是否合法的例子

WBOY
Release: 2016-06-13 11:19:55
Original
1338 people have browsed it



    Untitled


$in="2344";
if(ereg("^(-{0,1}|+{0,1})[0-9]+(.{0,1}[0-9]+)$",$in))
    echo "Ok!";
else
    echo "Sorry,Please input again!";
?>

很简单的嘛!




source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!