combining PHP functions
<p>I've inherited some php that parses an xml file to populate a page full of unordered lists and am wondering if there is a way to consolidate the php functions to make them more efficient.</p>

<p>There are 25 or so functions like the following:</p>

<pre><code>function oaAccounting(){

  // load SimpleXML
  $term = new SimpleXMLElement('training_list.xml', null, true);
  echo &lt;&lt;&lt;EOF
  &lt;ul&gt;
EOF;

  foreach($term as $term)
  {
     if(preg_match("/accounting/i", $term-&gt;keyword)){
        echo &lt;&lt;&lt;EOF
        &lt;li&gt;{$term-&gt;name}&lt;/li&gt;
EOF;
     }
  }
  echo '&lt;/ul&gt;';
}
</code></pre>

<p>each one scans the xml file for the term/keyword it's searching for and adds the term as a list element to an unordered list specific to that function. The next function does the same thing but for a different term/keyword and adds it to a separate unordered list.</p>

<p>is there a way to combine all this to prevent having to do the foreach and if 25 times in a row?</p>

<p>Thanks!</p>
