title: why does foreach go to the last element php
body: <p>I have $_POST array</p>
  
  <pre><code>    Array
  (
      [dddd] =&gt; Array
          (
              [students] =&gt; Array
                  (
                      [парарпа] =&gt; Array
                          (
                              [zach1] =&gt; 1
                              [zach2] =&gt; 1
                              [zach3] =&gt; 2
                              [zach4] =&gt; 3                               
                              [ekz1] =&gt; 5
                              [ekz2] =&gt; 5
                              [ekz3] =&gt; 5
                              [ekz4] =&gt;
                          )
  
                      [ававп] =&gt; Array
                          (
                              [zach1] =&gt; 3
                              [zach2] =&gt; 5
                              [zach3] =&gt; 4
                              [zach4] =&gt; 2
                              [ekz1] =&gt; 4
                              [ekz2] =&gt; 3
                              [ekz3] =&gt; 2
                              [ekz4] =&gt; 
                          )
  
                  )
  
              [zach1] =&gt; рпа
              [zach2] =&gt; рпарпарпар
              [zach3] =&gt; 
              [zach4] =&gt; пар
              [ekz1] =&gt; пав
              [ekz2] =&gt; авпав
              [ekz3] =&gt; ва
              [ekz4] =&gt; 
          )
  
      [ggg] =&gt; Array
          (
              [students] =&gt; Array
                  (
                      [авпва] =&gt; Array
                          (
                              [zach1] =&gt; 3
                              [zach2] =&gt; 3
                              [zach3] =&gt; 2
                              [zach4] =&gt; 
                              [ekz1] =&gt; 4
                              [ekz2] =&gt; 
                              [ekz3] =&gt; 
                              [ekz4] =&gt; 
                          )
  
                  )
  
              [zach1] =&gt; паыв
              [zach2] =&gt; авы
              [zach3] =&gt; ыва
              [zach4] =&gt; 
              [ekz1] =&gt; выа
              [ekz2] =&gt; 
              [ekz3] =&gt; 
              [ekz4] =&gt; 
          )
  
      [fffff] =&gt; Array
          (
              [students] =&gt; Array
                  (
                      [авыв] =&gt; Array
                          (
                              [zach1] =&gt; 5
                              [zach2] =&gt; 5
                              [zach3] =&gt; 
                              [zach4] =&gt; 
                              [ekz1] =&gt; 4
                              [ekz2] =&gt; 4
                              [ekz3] =&gt; 
                              [ekz4] =&gt; 
                          )
  
                      [ваыыва] =&gt; Array
                          (
                              [zach1] =&gt; 3
                              [zach2] =&gt; 3
                              [zach3] =&gt; 
                              [zach4] =&gt; 
                              [ekz1] =&gt; 2
                              [ekz2] =&gt; 3
                              [ekz3] =&gt; 
                              [ekz4] =&gt; 
                          )
  
                  )
  
              [zach1] =&gt; ва
              [zach2] =&gt; ва
              [zach3] =&gt; 
              [zach4] =&gt; 
              [ekz1] =&gt; ва
              [ekz2] =&gt; ва
              [ekz3] =&gt; 
              [ekz4] =&gt; 
          )
  
  )
  </code></pre>
  
  <p>And I'm trying to   </p>
  
  <pre><code>foreach($_POST as $groupName=&gt;$data) {echo $groupName;}
  </code></pre>
  
  <p>and it only echoes the last one "fffff". I have no idea what the hell is going on. Help me please. echo count($_POST); echoes 3</p>