title: What's wrong with my function for finding highest prime factor?
body: <pre><code>function find_highest_prime_factor($n)
  {
      for ($i = 2; $i &lt;= $n; $i++) 
      {   
          if (bcmod($n, $i) == 0) //its a factor
          {
              return max($i, find_highest_prime_factor(bcdiv($n,$i)));
          }
      }
      if ($i == $n)
      {
          return $n; //it's prime if it made it through that loop
      }
  }
  </code></pre>
  
  <p><strong>UPDATE</strong>: This is the correct answer, my bad!</p>