Horje
How to check if string is_numeric() Function in PHP

The is_numeric() function is an inbuilt function in PHP which is used to check whether a variable passed in function as a parameter is a number or a numeric string or not. The function returns a boolean value.

Syntax: 

bool is_numeric ( $var )

How to add is_numeric() Function in PHP

Follow the example.

index.php
Example: PHP
<?php
 
$num = 12;
if (is_numeric($num)) {
        echo $num . " is numeric";
    }
    else {
        echo $num . " is not numeric";
    }
 
?>

Output should be:

How to add is_numeric() Function in PHP





Category:
Web Tutorial
Sub Category:
PHP String Tutorial
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference