title: Nested 'foreach' for multidimensional array
body: <pre><code>&lt;?php
  $p_23 = array("Name"=&gt;"XYZ","Age"=&gt;"12");
  $a_23 = array("Class"=&gt;"5","Sec"=&gt;"A");
  $r_23 = array("Personal"=&gt;$p_23,"Academic"=&gt;$a_23);
  
  $p_24 = array("Name"=&gt;"ABC","Age"=&gt;"14");
  $a_24 = array("Class"=&gt;"6","Sec"=&gt;"B");
  $r_24 = array("Personal"=&gt;$p_24,"Academic"=&gt;$a_24);
  
  $stud = array("23"=&gt;$r_23,"24"=&gt;$r_24);
  
  foreach ($stud as $key =&gt; $value) {
      echo $value;
  }
  ?&gt;
  </code></pre>
  
  <p>Using echo is giving error,<br>
  previous issue resolved, expanding my question now.
  now i want this multi dimensional array to print like below using html tags<br>
      #Roll 23#<br>
        ##Academic##<br>
          -Class=>5<br>
          -sec=>B<br>
        Personal<br>
          -Name=>YXZ<br>
          -Age=>12<br>
      #Roll 24#<br>
        ##Academic##<br>
          -Class=>6<br>
          -sec=>A<br>
        Personal<br>
          -Name=>ABC<br>
          -Age=>12  </p>
  
  <p>--Nested foreach part with HTML tags--</p>
  
  <pre><code>foreach ($stud as $key =&gt; $value) {
      echo "&lt;h1&gt;Roll $key&lt;/h1&gt;";
      echo "&lt;ol&gt;";
      foreach ($r_23 as $key =&gt; $value) {
      echo "&lt;h2&gt;$key&lt;/h2&gt;";
      echo "&lt;ul&gt;";
      foreach ($p_23 as $key =&gt; $value){
      echo "&lt;li&gt;$key =&gt; $value&lt;/li&gt;";}
      echo "&lt;/ul&gt;";}
      echo "&lt;/ol&gt;";
  </code></pre>
  
  <p>but it is showing the same value for both academic and personal keys, which i dont exactly want. Thank u!! </p>