I want to check if a number is divisible by 6 and if not I need to increase it until it becomes divisible.
how can I do that ?
Use the Mod % (modulus) operator
if ($x % 6 == 0) return 1; function nearest_multiple_of_6($x) { if ($x % 6 == 0) return $x; return (($x / 6) + 1) * 6; }