How to divide numbers without remainder in PHP?

Solution 1:

Just cast the resulting value to an int.

$n = (int) ($i / $m);

Interesting functions (depending on what you want to achieve and if you expect negative integers to get devided) are floor(), ceil() and round().

Solution 2:

PHP 7 has a new built-in function for this named intdiv.

Example:

$result = intdiv(13, 2);

The value of $result in this example will be 6.

You can find the full documentation for this function in the PHP documentation.