PHP is_numeric() Function

PHP is_real() Function
PHP output_reset_rewrite_vars() Function

In this article, you will learn how to check if a number is numeric or not in PHP. The PHP is_numeric() function checks whether a variable is a number or a numeric string. This function returns true (1) if the variable is a number or a numeric string, otherwise it returns false/nothing.

what is the syntax of the IS_NUMERIC() function in php?

is_numeric(variable);
ParametersDetails
variableRequired. Specifies the variable to check
PHP IS_NUMERIC() method

examples of the IS_NUMERIC() function

Example 1. In this example, we check whether a variable is a number or a numeric string, or not.

<?php
$a = 32;
echo "a is " . is_numeric($a) . "<br>";

$b = 0;
echo "b is " . is_numeric($b) . "<br>";

$c = 32.5;
echo "c is " . is_numeric($c) . "<br>";

$d = "32";
echo "d is " . is_numeric($d) . "<br>";

$e = true;
echo "e is " . is_numeric($e) . "<br>";

$f = null;
echo "f is " . is_numeric($f) . "<br>";
?>
PHP is_real() Function
PHP output_reset_rewrite_vars() Function
en English
X
Scroll to Top