Modifying PHP function to accept different types of arrays
<p>I have a small function below that accepts associative arrays and I'm struggling to find a way to modify it to accept simpler arrays. It would be easy to create a separate function and remove a foreach loop, but I'm trying to see if there is a more efficient way to achieve this. Any insights would be greatly appreciated.</p>

<p>Function:</p>

<pre><code>public function set_content($file, $data, $section_name)
{
  $jobs = new Template_Engine();
  $jobs-&gt;set_file($file);
  $jobs_output = '';

  static $section_title = 0;
  foreach($data as $job)
  {
      //print_r($job);
      foreach($job as $key=&gt;$value)
      {
          $jobs-&gt;set($key,$value);
      }

      if ($section_title === 0) 
      {
          $jobs-&gt;set("section_title",$section_name);
      }
      else 
      {
          $jobs-&gt;clear_set("section_title");    
      }

      ++$section_title;
      $jobs_output .=  $jobs-&gt;output();
  }

  $section_title = 0;
  return $jobs_output;
}
</code></pre>

<p>Array Sample 1:</p>

<pre><code>Array ( [0] =&gt; Array ( [custom_id] =&gt; 78 [name] =&gt; Title Goes [description] =&gt; Test [resume_id] =&gt; 96 [order_id] =&gt; 0 [section_id] =&gt; 224 [profile_id] =&gt; 38 [user_id] =&gt; 1 [vanity_name] =&gt; Sample of Template 3 [template_id] =&gt; 3 [date_add] =&gt; 0000-00-00 00:00:00 [date_mod] =&gt; 2012-03-04 11:00:05 ) [1] =&gt; Array ( [custom_id] =&gt; 76 [name] =&gt; A Custom Item [description] =&gt; A descrition for a custom item goes here. [resume_id] =&gt; 96 [order_id] =&gt; 1 [section_id] =&gt; 224 [profile_id] =&gt; 38 [user_id] =&gt; 1 [vanity_name] =&gt; Sample of Template 3 [template_id] =&gt; 3 [date_add] =&gt; 0000-00-00 00:00:00 [date_mod] =&gt; 2012-03-04 11:00:05 ) )
</code></pre>

<p>Array Sample 2:</p>

<pre><code>Array ( [list_item] =&gt; EnglishSpanishFrenchCatalanJapanese )
</code></pre>
