title: PHP Loop Dynamic Variable
body: <p>I am trying to create a dynamic variable. I have a loop and I want it to loop through the records and create a variable for each record. My code:</p>
  
  <pre><code>$ct = 1;
  foreach ($record as $rec){
    $var.$ct = $rec['Name'];
    $ct = $ct + 1;
  }
  
  echo $var1;
  </code></pre>
  
  <p>When I try to use the above code, it gives me an error saying the <code>$var1</code> variable doesn't exist/undefined? Is it possible in PHP to create dynamic variables like the above example. If so, what am I doing wrong? </p>