title: "Cannot redeclare function" instead of "Cannot redeclare class"
body: <p>I've read this:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/708140/php-fatal-error-cannot-redeclare-class">PHP Fatal error: Cannot redeclare class</a></li>
  <li><a href="https://stackoverflow.com/questions/10930646/cannot-redeclare-function-php">Cannot redeclare function php</a></li>
  </ul>
  
  <p>We have this error: </p>
  
  <pre><code> PHP Fatal error:  Cannot redeclare fcXXX()
   (previously declared in /xx.class.php:3007) in /xx.class.php on line 3014
  </code></pre>
  
  <p>Yes. <strong><code>line 3014</code></strong>. And in the code source of <code>/xx.class.php</code> there are some class declarations <em>before</em> the function <code>fcXXX()</code>, something like (in short):</p>
  
  <pre><code>class P1 {
  ...
  }
  
  class P2 {
  ...
  }
  
  function fcXXX() {
  }
  </code></pre>
  
  <p>So what I dont get is that there should be an error of type "<code>PHP Fatal error: Cannot redeclare class</code>" <strong>before</strong> the fatal "<code>Cannot redeclare function php</code>".</p>
  
  <p>What is more strange, is that if you read carefully, the problem arises at the end of the declaration of the function. Here's the code with the lines:</p>
  
  <pre><code>3007 function fcXXX($p) {
  3008     $a = strpos($p, '.');
  3009     if ($a) {
  3010         return trim(substr($p, $a+1));
  3011     } else {
  3012         return trim($p);
  3013     }
  3014 }
  </code></pre>
  
  <p>Two strange things:</p>
  
  <ol>
  <li>in the function there's no "include" or "require" or whatever so <em>theorically</em> there could not be an error of this kind</li>
  <li>line <strong>3014</strong> raises the error in line <strong>3007</strong> (watch carefully the detailed error before).</li>
  </ol>
  
  <p>Has anyone ever had this problem, and where to check/test to solve it? (Please dont comment on how to optimize / how bad the code is, because it's not mine and I wont modify it)</p>