title: Adding dynamic variables to an array
body: <pre><code>    foreach ( $tbl_one_data as $row_ ) {
          $id = ( int ) $row_ [0];
          $time = mysql_real_escape_string ( $row_ [1] );
          $callid = mysql_real_escape_string ( $row_ [2] );
          $queuename = mysql_real_escape_string ( $row_ [3] );
  
          $arrayValues [] = "($id, '$time','$callid','$queuename',";
      }
  }
  </code></pre>
  
  <p>I am trying to improve the above code with the code below:</p>
  
  <pre><code>$b = 0;
          foreach ( $tbl_one_data as $row_ ) {
              if ($b &lt; count ( $row_ )) {
                  ${"var" . $b} = mysql_escape_string ( $row_ [$b] );
                  $b ++;
              }
          }
  </code></pre>
  
  <p>My question is how would I add the dynamic variables created into the array incrementally to achieve something like this: 
  <code>$arrayValues [] = "('$var0','$var1','$var2','$var3'";</code> ??</p>
  
  <p><code>$arrayValues [] = "('${"var" . $b}',";</code> doesn't seem to have the same effect as in my first code snippet.</p>