PHP is_numeric Function

What is is_numeric() in PHP?

Explanation

is_numeric function checks whether the given input value is a number or a numeric string.

Syntax:


is_numeric(variable)

Example :


<?php
$val=123.4;
if(is_numeric($val))
{
echo "This is a Numeric Value";
}
else
{
echo "This is not a Numeric Value";
}
?>

Result :

This is a Numeric Value

Check if a variable is a number or a numeric value using PHP is_numeric function.

PHP Topics


Ask Questions

Ask Question