Finding multiples of a number (eg. 3) 
Interview question. For this we need the modulus operator: %
In computing, the modulo operation finds the remainder of division of one number by another.


//Remainder of $a divided by $b
//$a % $b
//echo (5 % 3)."\n"; // prints 2

So,

//main logic
if($number % 3 ==0)
//No remainder(nothing left after division).Number is multiple of 3.

Comments
Comments are not available for this entry.
2024 By Angel Cool