title: function not included, why?
body: <p>what is wrong with my code??? :</p>
  
  <pre><code>function my_function()
  {
  $states = array('schwarz', 'rot', 'blau');
  
  $path = '';
  
  foreach ($states as $state) {
      $testPath = sprintf('transactions/Ordner/%s.png', $state);
  
      if (file_exists($testPath)) {
        $path = $testPath;
        echo $path;
      }
      else {
        $defaultPath = "inventory_images/8.jpg";
        echo $defaultPath;
      }
  }
  }
  
  
  $imagesPerLine = array(1=&gt;2, 2=&gt;3); $default = 4;
  $lines = array(1, 2, 3);
  $html="";
  foreach ($lines as $line) {
  if (!isset($imagesPerLine[$line])) {
    $imagesPerLine[$line] = $default;
  }
  $html.= "&lt;tr&gt;\n";
  for ($i = 1; $i &lt;= $imagesPerLine[$line]; $i++) {
    $html.=sprintf("&lt;td&gt;%s&lt;/td&gt;\n", my_function());
  }
  $html.="&lt;/tr&gt;\n";
  
  }
  echo $html;  
  </code></pre>
  
  <p>i thought, i included my_function() into the "td-tag", but it doesnt work, because none of my variables($path and $defaultPath) is echoed.
  i cant find my mistake, could you help me?...greetings </p>