Recall & Review
beginner
What does the '+' operator do in PHP?
The '+' operator adds two numbers together. For example, 3 + 2 equals 5.
Click to reveal answer
beginner
What is the result of 10 - 4 in PHP?
The result is 6 because the '-' operator subtracts the right number from the left number.
Click to reveal answer
beginner
How does the '*' operator work in PHP?
The '*' operator multiplies two numbers. For example, 5 * 3 equals 15.
Click to reveal answer
beginner
What does the '/' operator do in PHP?
The '/' operator divides the left number by the right number. For example, 10 / 2 equals 5.
Click to reveal answer
beginner
What is the '%' operator used for in PHP?
The '%' operator finds the remainder after division of one number by another. For example, 7 % 3 equals 1.
Click to reveal answer
What is the result of 8 + 2 * 3 in PHP?
✗ Incorrect
Multiplication (*) has higher priority than addition (+), so 2 * 3 = 6, then 8 + 6 = 14.
Which operator gives the remainder of a division in PHP?
✗ Incorrect
The '%' operator returns the remainder after division.
What is the output of 15 / 4 in PHP?
✗ Incorrect
Division (/) returns a float if the division is not exact.
What does the expression 5 - 10 evaluate to in PHP?
✗ Incorrect
Subtracting a larger number from a smaller one results in a negative number.
Which operator has the highest precedence in PHP among these?
✗ Incorrect
Multiplication (*) and modulus (%) have higher precedence than addition (+) and subtraction (-).
Explain how the basic arithmetic operators work in PHP and give an example for each.
Think about how you do math with numbers and how PHP uses symbols for these.
You got /6 concepts.
Describe the order of operations when using multiple arithmetic operators in a PHP expression.
Remember the math rule PEMDAS or BODMAS.
You got /3 concepts.