0
About PHP %
From this code: <?php $num = 9; $num = $num%2; ?> Why the result isn't 4 ?
1 Resposta
+ 2
The result of $num % 2 is not 4 because the % operator in PHP (and most programming languages) is the modulus operator, which returns the remainder of a division operation.
In this case, $num % 2 is dividing 9 by 2 and returning the remainder, which is 1. Therefore, the value of $num will be updated to 1, not 4.