title: Dynamic $_SESSION variable session names for loop PHP
body: <p>I'm creating dynamic <code>$_SESSION</code> variables with a simple for loop to print dates.</p>
  
  <pre><code>if($dateweekday ==='Tuesday'){
  for ($v=1;$v&lt;=4;$v++){
  $ttt = 'tuesday_'.$v;
  }
  echo $_SESSION[$ttt] = $newdateformat ;
  echo "&lt;br&gt;";
  }
  </code></pre>
  
  <p>result</p>
  
  <pre><code>2017-9-19 
  2017-9-26 
  2017-10-03 
  2017-10-10 
  </code></pre>
  
  <p>Looks good. But then my concern is the value of <code>$_SESSION[$ttt]</code>. The result should be</p>
  
  <pre><code>$_SESSION['tuesday_1'] = 2017-9-19;
  $_SESSION['tuesday_2'] = 2017-9-26;
  $_SESSION['tuesday_3'] = 2017-10-03;
  $_SESSION['tuesday_4'] = 2017-10-10;
  </code></pre>
  
  <p>When I <code>var_dump($_SESSION[$ttt])</code> this is what I get</p>
  
  <pre><code>string(10)
  string(9)
  string(9)
  string(9)
  </code></pre>
  
  <p>How can I make this work?</p>