Home >Backend Development >PHP Problem >How to implement integer division judgment in php
How to implement php integer division judgment: first create a php sample file; then define a variable; finally, judge whether the result is divisible according to the remainder operation, and the judgment statement is "if (! ($a % 5) && $a)".
php method to determine divisibility:
Method 1: Judgment based on remainder operation
$a = 5 if (!($a % 5) && $a) echo $a."可以被5整除";
Method 2:
It’s OK to directly take the remainder to 0, $a%5==0.
For more related knowledge, please visit PHP Chinese website!
The above is the detailed content of How to implement integer division judgment in php. For more information, please follow other related articles on the PHP Chinese website!