title: How to find prime factors in a range in php
body: <p>This is a program to find prime factors of a numbers. </p>
  
  <p>Like - Prime factors for number 1125 are <code>3</code> and <code>5</code></p>
  
  <p>My Algo this goes way - (and please let me know if it is not correct) </p>
  
  <ol>
  <li>Firstly I am finding a square root of the number using <code>sqrt()</code>
  function to break the complexity and run time.</li>
  <li>To find prime numbers in between the range.</li>
  <li>Lastly to divide these prime numbers with the original number(yet not reached to this step as failing in the second step.</li>
  </ol>
  
  <p>My code which is not working, let me know where exactly I am failing in my logic and code from step 2 and step 3.</p>
  
  <p><strong>No error thrown but the code is also not outputting anything.</strong></p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL);
  $number = 6006;
  
  $sqrt_num = (int)sqrt($number);
  
  for($i=2;$i&lt;$sqrt_num;$i++)
  {
      for($j=2;$j&lt;=$i-1;$j++)
      {
          if($i%$j==0)
          break;
          if($i==$j) 
              echo $i;
      }   
  }
  </code></pre>