title: PHP 5.3 Coding Standards: Anonymous functions in templates
body: <p>I can not seem to find any documents stating if anonymous functions in templates are a good idea when templating HTML with PHP. I have the following code for example:</p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;
  &lt;?
  $listMethod = function($items)
  {
      ?&gt;
      &lt;ul&gt;
          &lt;?foreach ($items as $item):?&gt;
              &lt;li&gt;&lt;?=$item?&gt;&lt;/li&gt;
          &lt;?endforeach;?&gt;
      &lt;/ul&gt;
  &lt;?
  };
  ?&gt;
  &lt;?=$listMethod(array('1','2','3'))?&gt;
  &lt;p&gt; AND &lt;/p&gt;
  &lt;?=$listMethod(array('a','b','c'))?&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Is this a good or bad way to create templates in PHP?</p>