title: Array in Array Php Foreach
body: <p>i have array in array foreach. </p>
  
  <p>I did not add html codes into foreach. Just to show an example. I've been working for 2 hours. Please help me.</p>
  
  <p>My array explode code;</p>
  
  <pre><code>string = "Deri Renk|kırmızı-siyah-beyaz-sarı-lacivert,kadife Renk|kırmızı-sarı";
  $delimiters = Array(",",":","|","-");
  
  $res = multiexplode($delimiters,$string);
  
  foreach ($res as $val) {
  echo $val;
  };
  </code></pre>
  
  <p>My Array Output;</p>
  
  <pre><code>Array
  (
  [0] =&gt; Array
      (
          [0] =&gt; Array
              (
                  [0] =&gt; Array
                      (
                          [0] =&gt; HEAD
                      )
  
                  [1] =&gt; Array
                      (
                          [0] =&gt; item1
                          [1] =&gt; item2
                          [2] =&gt; item3
                          [3] =&gt; item4
                          [4] =&gt; item5
                      )
  
              )
  
      )
  
  [1] =&gt; Array
      (
          [0] =&gt; Array
              (
                  [0] =&gt; Array
                      (
                          [0] =&gt; HEAD 2
                      )
  
                  [1] =&gt; Array
                      (
                          [0] =&gt; item1
                          [1] =&gt; item2
                      )
              )
      )
  );
  </code></pre>
  
  <p>I want to print as follows. It's a simple operation, but I could not do it because php is a bit of information. ;</p>
  
  <pre><code>&lt;div&gt;
  &lt;h1&gt;HEAD&lt;/h1&gt;
  &lt;ul&gt;
  &lt;li&gt;item1&lt;/li&gt;
  &lt;li&gt;item2&lt;/li&gt;
  &lt;li&gt;item3&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;div&gt;
  &lt;h1&gt;HEAD&lt;/h1&gt;
  &lt;ul&gt;
  &lt;li&gt;item1&lt;/li&gt;
  &lt;li&gt;item2&lt;/li&gt;
  &lt;li&gt;item3&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>my multiexplode function this: </p>
  
  <pre><code>function multiexplode ($delimiters,$string) {
  $ary = explode($delimiters[0],$string);
  array_shift($delimiters);
  if($delimiters != NULL) {
      foreach($ary as $key =&gt; $val) {
          $ary[$key] = multiexplode($delimiters, $val);
      }
  }
  return  $ary;
  }
  </code></pre>