title: php recursion error factoring
body: <p>so I am new at the idea of recursion and i wrote this simple code to factor a number ($n) this is the code:</p>
  
  <pre><code>$n = 120;
  $y = 1;
  
  function factor($n, $y) {
      if($y &gt; $n) {
          return 1;
      } else {
          $x = $n / $y;
          list($whole, $dec) = array_pad(explode('.', $x), 2, Null);
          if($dec == '') {
              echo 'x:' . $x . ' y:' . $y . '&lt;/br&gt;';
              return factor($n, ($y + 1));
          }
      }
  }
  </code></pre>
  
  <p>this is what the code outputs:</p>
  
  <pre><code>x:120 y:1
  x:60 y:2
  x:40 y:3
  x:30 y:4
  x:24 y:5
  x:20 y:6
  </code></pre>
  
  <p>so my question is why does this stop before it completes?</p>