Code:
function deleteFolder($folderPath)
{
if (is_dir($folderPath))
{
foreach (scandir($folderPath) as $value)
{
if ($value != "." && $value != "..")
{
$value = $folderPath . "/" . $value;
if (is_dir($value) )
{
$this->deleteFolder($value);
}
elseif (is_file($value) )
{
@unlink($value);
}
}
}
rmdir ($folderPath);
}
}