PHP 8.5.0 Alpha 1 available for testing

Voting

: five plus one?
(Example: nine)

The Note You're Voting On

holger1 at NOSPAMzentralplan dot de
15 years ago
Another simple way to recursively delete a directory that is not empty:

<?php
function rrmdir($dir) {
if (
is_dir($dir)) {
$objects = scandir($dir);
foreach (
$objects as $object) {
if (
$object != "." && $object != "..") {
if (
filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
}
?>

<< Back to user notes page

To Top