Skip to content
On this page

Expressions: Comparison Operations

Equal To

Equal to can be used to compare two expressions using the == operator, followed by the expression to compare to the right.

$foo = $bar == $baz;

Not Equal To

Not equal to can be used to compare two expressions using the != operator, followed by the expression to compare to the right.

$foo = $bar != $baz;

Identical To

Identical to can be used to compare two expressions using the === operator, followed by the expression to compare to the right.

$foo = $bar === $baz;

Not Identical To

Not identical to can be used to compare two expressions using the !== operator, followed by the expression to compare to the right.

$foo = $bar !== $baz;

Greater Than

Greater than can be used to compare two expressions using the > operator, followed by the expression to compare to the right.

$foo = $bar > $baz;

Greater Than Or Equal To

Greater than or equal to can be used to compare two expressions using the >= operator, followed by the expression to compare to the right.

$foo = $bar >= $baz;

Less Than

Less than can be used to compare two expressions using the < operator, followed by the expression to compare to the right.

$foo = $bar < $baz;

Less Than Or Equal To

Less than or equal to can be used to compare two expressions using the <= operator, followed by the expression to compare to the right.

$foo = $bar <= $baz;

Spaceship

Spaceship can be used to compare two expressions using the <=> operator, followed by the expression to compare to the right.

$foo = $bar <=> $baz;

Licensed under either of the MIT License or the Apache License (Version 2.0), at your option.