Home and Learn: PHP Programming Course

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:

PHP Operator Precedence List

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!


Ok, if all of that has given you a headache, let's move on to some practical work. In the next section, we'll take a look at HTML forms, and how to get data from them. This is so that we can do other things besides printing to the screen.

<-- Back One Page | Move on to the Next Part -->

Back to the PHP Contents Page


Email us: enquiry at homeandlearn.co.uk