syntax error, unexpected '}' - weird
<p>I'm using the code down below to delete old files, but it keeps saying: <code>syntax error, unexpected '}'</code>, but I can't spot where, please help me to fix it..</p>

<pre><code>function destroy($dir) {
$mydir = opendir($dir);
while($file = readdir($dir)) {
    if($file != "." &amp;&amp; $file != "..") {
        chmod($dir.$file, 0777);
        if(is_dir($dir.$file)) {
            chdir('.');
            while($dir.$file) {
                if(date("U",filectime($file) &gt;= time() - 3600)
                {
                    unlink($dir.$file)
                }
            }

        }
        else
            unlink($dir.$file) or DIE("couldn't delete $dir$file&lt;br /&gt;");
    }
}
closedir($dir);
}
</code></pre>
