exponent cannot have a fractional part¶
Description¶
The exponent argument, aka the second, must be an integer value. It might be negative, or even zero, but it cannot be with a decimal separator.
PHP tries to round it, so float values with only zeros after the decimal separator may work.
Example¶
<?php
echo bcpow('4.2', '3.2', 2); // 74.08
?>
Solutions¶
Check the argument with
is_int()
.Round the argument to an integer.