mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00

As of commit 90dcbbe
(PHP-7.2+) bcmod() supports non-integral
parameters as well. Since formerly only integer modulus has been
supported, it did not make much sense to cater to the scale with regard
to the result. However, now it does for consistency with other BCMath
operations.
Therefore, we add support for an optional `scale` parameter and fall
back to the default scale (`bcmath.scale`) as usual.
13 lines
325 B
PHP
13 lines
325 B
PHP
--TEST--
|
|
bcmod — Get modulus of an arbitrary precision number
|
|
--CREDITS--
|
|
Antoni Torrents
|
|
antoni@solucionsinternet.com
|
|
--SKIPIF--
|
|
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
echo bcmod('1', '2', '3', '4');
|
|
?>
|
|
--EXPECTF--
|
|
Warning: bcmod() expects at most 3 parameters, 4 given in %s.php on line %d
|