PHP: operators

Operators combine values, calculate results, assign data, and compare conditions in PHP.

What you will learn

Common groups

Arithmetic
+ - * / % calculate numbers.
Assignment
= stores a value; += updates it.
Comparison
=== checks value and type; !== checks that they differ.
Logical
&&, ||, and ! combine conditions.
<?php $age = 20; if ($age >= 18 && $age < 65) { echo 'Working-age example'; } ?>

Use parentheses when they make the intended grouping clearer.

Common mistakes