Skip to content

Commit

Permalink
Merge pull request wangzheng0822#261 from qqlcbb/master
Browse files Browse the repository at this point in the history
修复小数位不存在报错的情况
  • Loading branch information
wangzheng0822 authored Mar 11, 2019
2 parents 2c6b918 + 27356d1 commit d3431d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion php/15_binary/binary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

// 测试二分查找给定值
Expand Down

0 comments on commit d3431d6

Please sign in to comment.