bcdiv
is a function in PHP that computes the division of arbitrary precision numbers.
bcdiv(string $num1, string $num2, int $scale = null): string
num1
- variable of type string
.
num1
is a dividend.
num2
- variable of type string
.
num2
is a divisor.
scale
- variable of type int
. This is an optional parameter. scale
is used to set the number of digits after the decimal place in the result. The default value of scale
is 0.The function returns the num1
/num2
. The value returned is of type string
.
null
is returned ifnum2
is zero.
<?php $num1 = '105'; $num2 = '6.55957'; echo bcdiv($num1, $num2, 3); ?>
16.007
RELATED TAGS
CONTRIBUTOR
View all Courses