title: Fatal error: Cannot redeclare function() previously declared
body: <p>I know that there are a LOT of questions with similar issues BUT I've been looking for the answer and still can't find my issue. I've already tried several ways to fix this but I can't find any solution to my case...</p>
  
  <p>portion of my code: (I'm not using this function anywhere else)</p>
  
  <pre><code>function Validar($r)
  {
  $Msg = '';
  $aError = array();
  if (strlen($Msg) &gt; 0) {
      $aError[] = array('success' =&gt; false);
      $aError[] = array('msg' =&gt; '1001');
      $aError[] = array('error' =&gt; $Msg);;
  }
  </code></pre>
  
  <p>And I get the following:</p>
  
  <blockquote>
    <p>Fatal error: Cannot redeclare Validar() (previously declared in
    C:\wamp64\www\myProject-dev\public\cajas\reposiciones\controller3.php:20)
    in C:\wamp64\www\myProject-dev\public\cajas\reposiciones\controller3.php
    on line 20</p>
  </blockquote>
  
  <p>So I added </p>
  
  <pre><code>if(function_exists("Validar")){
  echo "The function already exists.";
  } else {
   function Validar($r){
     $Msg = '';
     $aError = array();
     if (strlen($Msg) &gt; 0) {
      $aError[] = array('success' =&gt; false);
      $aError[] = array('msg' =&gt; '1001');
      $aError[] = array('error' =&gt; $Msg);;
    }
  </code></pre>
  
  <p>So I can barely have a clue of what's going on and I got 256 lines with my message </p>
  
  <blockquote>
    <p>The function already exists.</p>
  </blockquote>
  
  <p>followed by </p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Maximum function nesting level of '256' reached, aborting! in C:\wamp64\www\myProject-dev\public\lib\DataSourceResult.php on line 39</p>
    
    <p>Error: Maximum function nesting level of '256' reached, aborting! in C:\wamp64\www\myProject-dev\public\lib\DataSourceResult.php on line 39</p>
  </blockquote>
  
  <p>And a table like this one: (sorry, I don't know how to make one in my question)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;#&lt;/th&gt;&lt;th&gt;Time&lt;/th&gt;&lt;th&gt;Memory&lt;/th&gt;&lt;th&gt;Function&lt;/th&gt;&lt;th&gt;Location&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;0.0017&lt;/td&gt;&lt;td&gt;371568&lt;/td&gt;&lt;td&gt;{main}( )&lt;/td&gt;&lt;td&gt;...\controller3.php:0&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;0.0053&lt;/td&gt;&lt;td&gt;474480&lt;/td&gt;&lt;td&gt;include( 'C:\wamp64\www\myProject-dev\public\cajas\reposiciones\controller3.php' )&lt;/td&gt;&lt;td&gt;...\controller3.php:36&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;0.0091&lt;/td&gt;&lt;td&gt;476240&lt;/td&gt;&lt;td&gt;include( 'C:\wamp64\www\myProject-dev\public\cajas\reposiciones\controller3.php' )&lt;/td&gt;&lt;td&gt;...\controller3.php:36&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
  &lt;br&gt;&lt;br&gt;&lt;br&gt;
  And this repeats 256 times.</code></pre>
  </div>
  </div>
  </p>
  
  <p>What does it mean and how can I fix it? Maybe you can guide or advise me a bit, I'm kinda new.</p>
  
  <p>Thanks in advance.</p>