title: What is the best function or method for computing modulus (Remainder of $a divided by $b) in PHP?
body: <p>PHP provides different functions for computing modulus:</p>
  
  <ol>
  <li><a href="http://php.net/manual/en/language.operators.arithmetic.php" rel="nofollow noreferrer">Modulus operator <code>%</code></a>: <code>echo ($a % $b);</code></li>
  <li><a href="http://php.net/manual/en/function.fmod.php" rel="nofollow noreferrer">fmod()</a></li>
  <li><a href="http://php.net/manual/en/function.bcmod.php" rel="nofollow noreferrer">bcmod()</a></li>
  <li><a href="http://php.net/manual/en/function.gmp-mod.php" rel="nofollow noreferrer">gmp_mod()</a></li>
  </ol>
  
  <p>Which function should be used that considered safe and efficient? considering the (devision by zero issue that described here: <a href="https://stackoverflow.com/questions/18069825/division-by-zero-error-while-using-modulus">Division by zero error while using modulus</a> and floating numbers?</p>