PHP - Fatal error: Cannot redeclare delete_directory() previously declared on line 4
<p>I am running a loop to delete old members files but I get the following error below and I was wondering how can I correct it so that I can delete more then one members files?</p>

<pre><code>Fatal error: Cannot redeclare delete_directory() previously declared on line 4
</code></pre>

<p>Here is PHP code.</p>

<pre><code>for($x = 0; $x &lt; count($delete_member); $x++){

    //delete members files and folders from the server
    $dirname = './members/' . $delete_member[$x] . '/';
    function delete_directory($dirname) {
       if (is_dir($dirname)) {
          $dir_handle = opendir($dirname);
       }
       if (!$dir_handle) {
          return false;
       }
       while($file = readdir($dir_handle)) {
          if ($file != "." &amp;&amp; $file != "..") {
             if (!is_dir($dirname."/".$file)) {
                unlink($dirname."/".$file);
             } else {
                delete_directory($dirname.'/'.$file);
             }
          }
       }
       closedir($dir_handle);
       rmdir($dirname);
       return true;
    }

    delete_directory($dirname);
}
</code></pre>
