AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Communication Technology

Operators and the if statement

Week 12 · Unit 3 Creating Site Pages (5), Topic 2 Operators and conditional statements in PHP: arithmetic, assignment, comparison and logical operators, if, else, elseif and the in-line if · 3 lessons
Answers are for parents and teachers.
1
Trace $x: $x = 9; $x -= 4; $x *= 3; $x %= 7; $x++;
2
Complete the truth table for X ∨ Y when X is false and Y is true; then for X ∧ Y.
3
A shop gives a discount to members with 20 points or more. Write the condition, then say whether a member with exactly 20 points gets it.
4
What does this print? $age = 15; if ($age >= 18) { echo "adult"; } elseif ($age >= 13) { echo "teen"; } else { echo "child"; }
5
Find the two syntax mistakes: $y = ($x = = 1) ? "A" : "B"; and $count–;