PHP 8.5.0 Alpha 4 available for testing

Voting

: five minus five?
(Example: nine)

The Note You're Voting On

nbari at dalmp dot com
12 years ago
Glob function doesn't return the hidden files, therefore scandir can be more useful, when trying to delete recursively a tree.

<?php
public static function delTree($dir) {
$files = array_diff(scandir($dir), array('.','..'));
foreach (
$files as $file) {
(
is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
}
return
rmdir($dir);
}
?>

<< Back to user notes page

To Top