title: PHP array and htmlentities
body: <pre><code>$_POST=
  
  Array ( [0] =&gt; aaa@gmail.com [1] =&gt; bbb [2] =&gt; ccc [3] =&gt; ddd [4] =&gt; eee [5] =&gt; fff [6] =&gt; ggg [7] =&gt; hhh [8] =&gt; iii [9] =&gt; jjj [10] =&gt; 31 [11] =&gt; k )
  
  foreach($_POST as $key =&gt; $val){
      for ($key = 0; $key &lt;= 9;$key++){
          $_POST2[$val] = htmlentities($_POST[$val]);
      }
  }
  }
  </code></pre>
  
  <p>This is my code and what I was trying to do was that I wanted to split the <code>$_POST</code> array into <code>$key</code> and <code>$val</code>. Then I wanted to tell the program that as the <code>$key</code> goes up by <code>1</code>, put <code>htmlentities()</code> around the <code>$val</code>.
  Can you please help me? I have been stuck on this for hours.</p>