Transwiki:PHP Programming/Comparison

出典: フリー教科書『ウィキブックス(Wikibooks)』
ナビゲーションに移動 検索に移動


The operators for comparison in PHP are the following:

Operator Name Returns true, if…
== equal left & right side equals
=== identical == is true, and both sides have the same type
!= not equal left & right are not equal after type juggling
<> not equal synonym of !=
!== not identical != is true, or their types differ
<> not equal synonym of !=
< less than left side is strictly less than right side
> greater than left side is strictly greater than right side
<= less than or equal to left side is less than or equal to right side
>= greater than or equal to left side is greater than or equal to right side
<=> spaceship integer less than, equal to, or greater than zero when left side is respectively less than, equal to, or greater than right side (≥ PHP 7).
$a ?? $b
?? $c
null coalescing first operand from left to right that exists and is not NULL. NULL, if no values are defined and that not NULL (≥ PHP 7).

Example of comparisons[編集]

テンプレート:Code:PHPHTML

External Links[編集]