PHP is_numeric: Number String Validation
The is_numeric function is used to check if a variable is a number or a numerical string. It returns true if the variable can be interpreted as a number, and false otherwise.
For example,
$var1 = 10;
$var2 = "20";
$var3 = "Hello";
echo is_numeric($var1); // 输出 true
echo is_numeric($var2); // 输出 true
echo is_numeric($var3); // 输出 false