1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Division by Zero

Discussion in 'Development' started by BlawoHD, Jul 23, 2018.

  1. BlawoHD

    BlawoHD Silverfish

    Messages:
    21
    [17:27:57] [Server thread/CRITICAL]: [KnockFFA] Could not execute task BlawoHD\KnockFFA\Stats: Division by zero
    [17:27:57] [Server thread/CRITICAL]: ErrorException: "Division by zero" (EXCEPTION) in "KnockFFA - BlawoHD/src/BlawoHD/KnockFFA/Stats" at line 287

    PHP:
    $kd round($kills / ($tode !== $tode 1), 2);
     
  2. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    that occurs because the variable $kills and ($tode !== 0 ? $tode : 1) are null, $kills or ($tode !== 0 ? $tode : 1) needs to be higher > 0
     
  3. RumDaDuMCPE

    RumDaDuMCPE Witch

    Messages:
    67
    GitHub:
    RumDaDuMCPE
    PHP:
    $kd $kills !== ?? round($kills / ($tode !== $tode 1), 2);
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.