<?php
string bcsqrt ( string $num, ?int $scale = null )
where,
$num = The operand as STRING
$scale = The number of decimal places
to be considered in this operation
?>
<?php
function sqroot ($op01, $sc01)
{
if($op01 < 0)
{
echo 'Square root of negative numbers is not defined.<br>';
}
{
echo 'bcsqrt( ' . $op01 . ', ' . $sc01 . ' ) = ';
var_dump(bcsqrt( $op01, $sc01));
echo '<br><br>';
}
}
sqroot(M_PI, 10);
sqroot(5, 6);
sqroot('5', 6);
sqroot(-5, 4);
sqroot(M_E, 8);
sqroot(0, 0);
?>