PHP Operator Precedence

Here’s a list of the operators you’ve met so far, and the order of precedence. This can make a difference, as we saw during the mathematical operators. Don’t worry about these too much, unless you’re convinced that your math or logical is correct. In which case, you might have to consult the following:


The only operators you haven’t yet met on the list above are the = = = and != = operators.

In recent editions of PHP, two new operators have been introduced: the triple equals sign ( = = =) and an exclamation, double equals ( != =). These are used to test if one value has the same as another AND are of the same type. An example would be:

$number = 3;
$text = 'three';

if ($number === $text) {


else {

print("Not the same");


So this asks, “Do the variables match exactly?” Since one is text and the other is a number, the answer is “no”, or false. We won’t be using these operators much, if at all!

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.