It gets a Function that checks whether the transmitted parameter is a number. * Determine whether the transmitted data is a number. use a regular expression to determine whether the entered number is valid. call: checknum (parameter 1, parameter 2) * The Copy code is as follows: functionchecknum ($ id, $ say/* determine whether the specially transmitted data is a number
Use regular expressions to determine whether the input number is valid
Call: checknum (parameter 1, parameter 2)
*/
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. ", entry:". ". $ inid ."";
Exit;
}
}
Call
The code is as follows:
$ Tid = "111fff ";
Checknum ($ tid, "invalid number ")
?>
Using a regular expression to determine whether the input number is valid: checknum (parameter 1, parameter 2) */code: functionchecknum ($ id, $ say...