Problem Statement
Which operator can check if a number is even or odd in PHP?
Explanation
The modulus operator (%) checks the remainder of division. If number % 2 equals zero, the number is even; otherwise, it's odd.
Code Solution
SolutionRead Only
if($num % 2 == 0) echo 'Even';
Practice Sets
This question appears in the following practice sets:
