[英]PHP|BCMath: How to get bcscale value?
How do I get the scale set in BCMath's bcscale() method? 如何在BCMath的bcscale()方法中设置比例?
Example: 例:
bcscale(25);
How do I get the 25? 我怎么得到25? Thanks! 谢谢!
You can't. 你不能。 Currently you can get only the bcmath.scale
INI setting, which defaults to 0: 目前,您只能获得bcmath.scale
INI设置,默认为0:
print ini_get('bcmath.scale');
Unfortunatelly bcscale()
didn't change the bcmath.scale
INI setting and you can't get the scale factor without a workaround like that: 不幸的是, bcscale()
没有改变bcmath.scale
INI设置,如果没有像这样的解决方法,你无法获得比例因子:
bcscale(25);
function get_bcscale()
{
$sqrt = bcsqrt('2');
return strlen(substr($sqrt, strpos($sqrt, '.') + 1));
}
var_dump(get_bcscale()); # int(25)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.