search
HomeBackend DevelopmentPHP ProblemPHP determines whether it is a numeric type

PHP determines whether it is a numeric type

Sep 25, 2019 am 11:54 AM
phpjudgmentNumeric type

PHP determines whether it is a numeric type

PHP is_numeric detects whether the variable is a number or a numeric string

Function syntax:

bool is_numeric ( mixed $var )

If var is a number or numeric string, return TRUE, otherwise return FALSE.

Example 1:

<?php
    $v = is_numeric (&#39;58635272821786587286382824657568871098287278276543219876543&#39;) ? true : false;
    
    var_dump ($v);
?>

The above script will output:

bool(true)

Example 2:

<?php
$str="0";
$strTest=is_numeric(0);
var_dump($strTest);
?>
boolean true

Knowledge expansion:

is_bool();//Determine whether it is a Boolean type
is_float(); //Determine whether it is a floating point type
is_int(); //Judge whether it is an integer type
is_numeric(); //Judge whether it is a numeric type
is_string(); //Judge whether it is a numeric type Whether it is a string
is_array(); //Judge whether it is an array
is_object(); //Judge whether it is an object

Recommended tutorial : PHP video tutorial

The above is the detailed content of PHP determines whether it is a numeric type. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools