修复小数位不存在报错的情况

This commit is contained in:
qqlcbb 2019-03-07 11:19:02 +08:00
parent 2c6b918020
commit 27356d1cdd

View File

@ -86,7 +86,11 @@ function squareRoot($number)
function getDecimalPlaces($number)
{
$temp = explode('.', $number);
return strlen($temp[1]);
if (isset($temp[1])) {
return strlen($temp[1]);
}
return 0;
}
// 测试二分查找给定值