title: Iterating through set $_POST variables by type?
body: <p>I have user inputs as follows:</p>
  
  <pre><code>&lt;form action="special.php" method="post"&gt;
      &lt;input name="first1"&gt; &lt;input name="last1"&gt; &lt;input name="age1"&gt;
      &lt;input name="first2"&gt; &lt;input name="last2"&gt; &lt;input name="age2"&gt;
      &lt;input name="first3"&gt; &lt;input name="last3"&gt; &lt;input name="age3"&gt;
      &lt;input name="first4"&gt; &lt;input name="last4"&gt; &lt;input name="age4"&gt;
      &lt;input name="first5"&gt; &lt;input name="last5"&gt; &lt;input name="age5"&gt;
      &lt;input name="first6"&gt; &lt;input name="last6"&gt; &lt;input name="age6"&gt;
      ...
  
      N
  &lt;/form&gt;
  </code></pre>
  
  <p>The amount of user inputs in the form is determined by the user; meaning, the user can add 5,10,20 additional lines to the code above, creating new input elements (following the pattern above) as they fit. </p>
  
  <p>My question is, once the form gets submitted, what is an easy way to iterate and print out all the SET POST variables? </p>
  
  <p>Something like:</p>
  
  <pre><code>for($i=0; $i &lt; $numPostVars; $i++){
     if(isset($_POST['first".$i."'])){
         //echo all first names post variables that are set
      }
  }
  
  // do the same from last names &amp; age in separate loops
  </code></pre>