title: Fatal error: Cannot redeclare function
body: <p>I've a problem, with this function.</p>
  
  <p>How can solve this?</p>
  
  <hr>
  
  <p><strong>My Code:</strong></p>
  
  <pre><code>// Buscar Tema
  $guardardato = array();
  
  foreach($html-&gt;find('table', 2)-&gt;find('tr') as $datossc) {
      $title = $datossc-&gt;find('td', 1)-&gt;plaintext;
      if ($title != 'Song Title') {
  
          $guardardato[0] = $title;
  
          $guardardato[0] = preg_replace( "(-)", " - ", $guardardato[0]);
          $guardardato[0] = preg_replace( "(:)", "", $guardardato[0]);
          $guardardato[0] = preg_replace( "([0-9]+)", "", $guardardato[0]);
          $guardardato[0] = preg_replace( "(Current Song)", "", $guardardato[0]);
          $guardardato[0] = preg_replace( "(pista)", "", $guardardato[0]);
          $guardardato[0] = preg_replace( "(pista)", "", $guardardato[0]);
          $guardardato[0] = preg_replace( "(www.[a-z]+.com.ar)", "", $guardardato[0]);
          $guardardato[0] = preg_replace( "(www.[a-z]+.com)", "", $guardardato[0]);
          $guardardato[0] = preg_replace( "(www.[a-z]+.net)", "", $guardardato[0]);
          $guardardato[0] = preg_replace( "([a-z]+.com.ar)", "", $guardardato[0]);
          $guardardato[0] = preg_replace( "([a-z]+.com)", "", $guardardato[0]);
          $guardardato[0] = preg_replace( "([a-z]+.net)", "", $guardardato[0]);
          $guardardato[0] = ucwords(strtolower($guardardato[0]));
  
          function obtener($guardardato) {
              foreach ($guardardato as $k =&gt; $v){
                  return $v;
              }
          }
          print obtener($guardardato);
      }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p><strong>Fatal error:</strong> Cannot redeclare obtener() (previously declared in C:\xampp\htdocs...\index.php:43) in <strong>C:\xampp\htdocs...\index.php</strong> on line <strong>43</strong></p>
  </blockquote>
  
  <hr>
  
  <p><strong>Line 43:</strong> </p>
  
  <pre><code>function obtener($guardardato) {
  </code></pre>
  
  <hr>
  
  <p>I try with <a href="https://stackoverflow.com/a/21831732/3187989">this posible solution</a> but thats does work.</p>
  
  <p>Can help me?</p>
  
  <p>Thanks.</p>