To find the remainder of two numbers in PHP, you can use the modulus operator (%). The modulus operator gives the remainder of the division of the first operand by the second.
Here's how to use the modulus operator in PHP:
main.php134 chars7 linesOutput:
main.php39 chars2 lines
In this example, the modulus operator finds the remainder of $number1 divided by $number2 and assigns it to $remainder. Then, the echo statement displays the result.
Note that the modulus operator (%) can only be used with integer operands.
gistlibby LogSnag