title: Simple PHP Question: Using an IF statement inside a FOR loop
body: <p>Inside a for loop, I'm trying to set a variable based on the what iteration of the loop it's on: </p>
  
  <pre><code>&lt;?php 
  for ($k = 0; $k &lt; 3; $k++){ 
      if ($k = 0) : $var = 'zero';    
      elseif ($k = 1) : $var = 'one'; 
      else : $var = 'two';
      endif;  
  ?&gt;
  
  This is iteration &lt;?php echo $var; ?&gt;.
  
  &lt;?php }; ?&gt;
  </code></pre>
  
  <p>But it continues looping forever until my browser freezes... what's going on? Any help would be greatly appreciated!</p>