Search code examples
phpfloor

php floor a number as times of 18


How to make a function so that make floor all the number as times of 18?

example:

3 => 0

17 => 0

19 => 18

43 => 36

69 => 54

Thanks.


Solution

  • $a = 19;
    $a -= $a % 18; // => 18