Home >Backend Development >PHP Problem >What are comparison operators in php

What are comparison operators in php

(*-*)浩
(*-*)浩Original
2019-09-09 14:07:427002browse

php comparison operator, which allows comparison of two values.

What are comparison operators in php

Comparison operators, as their name implies, allow two values ​​to be compared. You can also refer to the PHP type comparison table for examples of how different types compare to each other. (Recommended learning: PHP Programming from Beginner to Master)

What are comparison operators in php

The following example shows different results of using certain comparison operators:

Example

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

var_dump($x == $y);
echo "<br>";
var_dump($x === $y);
echo "<br>";
var_dump($x != $y);
echo "<br>";
var_dump($x !== $y);
echo "<br>";

$a=17;
$b=8;

var_dump($a > $b);
echo "<br>";
var_dump($a < $b);
?>

The above is the detailed content of What are comparison operators in php. 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
Previous article:how to test php codeNext article:how to test php code