title: How to get a form input array into a PHP array
body: <p>I have a form like the one below which is posted to <em>contacts.php</em>, and the user can dynamically add more with <a href="https://en.wikipedia.org/wiki/JQuery" rel="noreferrer">jQuery</a>.</p>
  <pre class="lang-html prettyprint-override"><code>&lt;input type=&quot;text&quot; name=&quot;name[]&quot; /&gt;
  &lt;input type=&quot;text&quot; name=&quot;email[]&quot; /&gt;
  
  &lt;input type=&quot;text&quot; name=&quot;name[]&quot; /&gt;
  &lt;input type=&quot;text&quot; name=&quot;email[]&quot; /&gt;
  
  &lt;input type=&quot;text&quot; name=&quot;name[]&quot; /&gt;
  &lt;input type=&quot;text&quot; name=&quot;email[]&quot; /&gt;
  </code></pre>
  <p>If I echo them out in PHP with the code below,</p>
  <pre><code>$name = $_POST['name'];
  $email = $_POST['account'];
  
  foreach($name as $v) {
      print $v;
  }
  
  foreach($email as $v) {
      print $v;
  }
  </code></pre>
  <p>I will get something like this:</p>
  <blockquote>
  <p>name1name2name3email1email2email3</p>
  </blockquote>
  <p>How can I get those arrays into something like the code below?</p>
  <pre><code>function show_Names($n, $m)
  {
      return(&quot;The name is $n and email is $m, thank you&quot;);
  }
  
  $a = array(&quot;name1&quot;, &quot;name2&quot;, &quot;name3&quot;);
  $b = array(&quot;email1&quot;, &quot;email2&quot;, &quot;email3&quot;);
  
  $c = array_map(&quot;show_Names&quot;, $a, $b);
  print_r($c);
  </code></pre>
  <p>so my output is like this:</p>
  <blockquote>
  <p>The name is <i>name1</i> and email is <i>email1</i>, thank you
  The name is <i>name2</i> and email is <i>email2</i>, thank you
  The name is <i>name3</i> and email is <i>email3</i>, thank you</p>
  </blockquote>