title: This code is displaying an INF value on the screen
body: <p>The following code is displaying INF as the result. How can I fix it?</p>
  <pre><code>&lt;?php
      function fibonacci($n)
      {
          $a = 1;
          $b = 1;
          $result = 0;
          for ($i = 0; $i &lt; $n; $i=$i+1)
          {
              $sum = $a + $b;
              $a = $b;
              $b = $sum;
              if ($a % 2 == 0)
              {
                  $result = $result + $a;
              }
          }
          echo &quot;&lt;br/&gt;&quot; . $result;
      }
  
      echo fibonacci(400000);
  ?&gt;
  </code></pre>