Warning: Division by zero in hatası

  • Thread starter Thread starter EnesVTN
  • Başlangıç zamanı Başlangıç zamanı
  • Cevaplar : 2
  • Görüntülenme : 5K

EnesVTN

Üye
Tarih
1/1/16
Konular
8
Mesaj
88
Tepki puanı
0
Yer
Usa
merhaba arkadaşlar sistemde Warning: Division by zero in hatası alıyorum bunun için bana yardımcı olurmusunuz kodu vereceğim

$totalUnits = $statisticResult['lostunits'] + $statisticResult['desunits'];
$varLost = 100/$totalUnits * $statisticResult['lostunits'];
$varDest = 100/$totalUnits * $statisticResult['desunits'];


bu şekilde kodum var değişken değeri sorunu sanırım bunu düzeltmemde yardımcı olurmusunuz delircem çözemedim bi türlü
 
  1. $varLost = $totalUnits == 0 ? 0 : 100/$totalUnits * $statisticResult['lostunits'];
  2. $varDest = $totalUnits == 0 ? 0 : 100/$totalUnits * $statisticResult['desunits'];


    bu kanka çözümü
 
Top