/*Determine whether the transmitted data is a number
Use regular expressions to determine whether the entered number is legal
Call: checknum (parameter 1, parameter 2)
*/
Copy code The code is as follows:
function checknum($id,$say)
{
$inid=$id;
if(! ereg("^(-{0,1}|+{0,1})[0-9]+(.{0,1}[0-9]+)$",$inid))
{
echo $say.", entrance: "."".$inid."";
exit;
} }
}
Call
Copy code The code is as follows:
$tid="111fff";
checknum($tid,"Illegal number")
?>
http://www.bkjia.com/PHPjc/317321.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317321.htmlTechArticle/* Determine whether the transmitted data is a number. Use regular expressions to determine whether the entered number is legal. Call: checknum(parameter 1, Parameter 2) */ Copy the code code as follows: functionchecknum($id,$say...
Statement: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