search
HomeBackend DevelopmentPHP ProblemWhat happens when the same numbers in PHP are not equal?

When PHP determines that the same numbers are not equal, it means that although they have the same value, their types are different. Therefore, when using the comparison operator equals symbol "===" in PHP to determine that two are the same When the number is , return false, indicating that the types are different.

What happens when the same numbers in PHP are not equal?

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

When the same numbers in PHP are judged to be unequal, It means that although their values ​​are the same, their types are different. Therefore, when the comparison operator equals symbol "===" is used to judge two identical numbers and returns false, it means that the types are different.

==, equal to, $x == $y, returns true if $x is equal to $y.

===, congruent (identical), $x === $y, returns true if $x is equal to $y and they are of the same type.

Example:

<?php
$x = 17;  
$y = "17";

var_dump($x === $y); // 返回 false,因为类型不同
?>

Output result:

bool(false)

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What happens when the same numbers in PHP are not equal?. 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 Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.