PHP
php Division by zero 오류
sj0020
2021. 7. 5. 10:58
Warning: Division by zero inC:\xampp\htdocs\경로 .,.. 파일이름.phpon line652
print_r($total_of_propln_total);
// if ($total_of_propln_total = 0) {
// $today_percent = 0;
//
// }else{
// $today_percent = ((int)$number / (int)$total_of_propln_total) * 100;
// }
// 생산계획 수가 없을 때 예외처리
if ($total_of_propln_total >0) {
$today_percent = ((int)$number / (int)$total_of_propln_total) * 100;
} else{
$today_percent = 0;
}
분모가 0 이라서 나는 오류..
예외처리 해주기.
주석처리한 윗부분으로 하면 왜 안되는가 ? 모르겠음