PHPPHP7 min read

PHP Operators and Basic Math

Use arithmetic, comparison, and logical operators to build conditions and logic.

Ryan Adams
December 21, 2025
0.0k0

Operators help you perform actions on values. ## Arithmetic operators ```php $a = 10; $b = 3; echo $a + $b; // 13 echo $a - $b; // 7 echo $a * $b; // 30 echo $a / $b; // 3.33 echo $a % $b; // 1 ``` ## Comparison operators ```php var_dump(5 == "5"); // true var_dump(5 === "5"); // false (type matters) ``` ## Logical operators ```php if ($age > 18 && $isStudent) { echo "Adult student"; } ``` > Next: if, else, and decision making.

#PHP#Operators#Beginner