src/Stdlib/Util.php
public static function delDir($dir) {
        $all = self::readDir($dir, self::ALL, true, NULL);
        if (isset($all['files'])) {
            foreach ($all['files'] as $file) {
                if (is_array($file)) {
                    foreach ($file as $fil) {
                        if (!unlink($fil)) {
                            return false;
                        }
                    }
                } else {
                    if (!unlink($file)) {
                        return false;
                    }
                }
            }
        }

        if (isset($all['dirs'])) {
            foreach (array_reverse($all['dirs']) as $_dir) {
                if (is_array($_dir)) {
                    foreach ($_dir as $_dr) {
                        if (!rmdir($_dr)) {
                            return false;
                        }
                    }
                } else {
                    if (!rmdir($_dir)) {
                        return false;
                    }
                }
            }
        }

        return rmdir($dir);
    }
public static function delDir($dir) {
        $all = self::readDir($dir, self::ALL, true, NULL);
        if (isset($all['files'])) {
            foreach ($all['files'] as $file) {
                if (is_array($file)) {
                    foreach ($file as $fil) {
                        if (!unlink($fil)) {
                            return false;
                        }
                    }
                } else {
                    if (!unlink($file)) {
                        return false;
                    }
                }
            }
        }

        if (isset($all['dirs'])) {
            foreach (array_reverse($all['dirs']) as $_dir) {
                if (is_array($_dir)) {
                    foreach ($_dir as $_dr) {
                        if (!rmdir($_dr)) {
                            return false;
                        }
                    }
                } else {
                    if (!rmdir($_dir)) {
                        return false;
                    }
                }
            }
        }

        return rmdir($dir);
    }
public static function delDir ( $ dir ) { $ all = self :: readDir ( $ dir , self :: ALL , true , NULL ) ; if ( isset ( $ all [ 'files' ] ) ) { foreach ( $ all [ 'files' ] as $ file ) { if ( is_array ( $ file ) ) { foreach ( $ file as $ fil ) { if ( ! unlink ( $ fil ) ) { return false ; } } } else { if ( ! unlink ( $ file ) ) { return false ; } } } } if ( isset ( $ all [ 'dirs' ] ) ) { foreach ( array_reverse ( $ all [ 'dirs' ] ) as $ _dir ) { if ( is_array ( $ _dir ) ) { foreach ( $ _dir as $ _dr ) { if ( ! rmdir ( $ _dr ) ) { return false ; } } } else { if ( ! rmdir ( $ _dir ) ) { return false ; } } } } return rmdir ( $ dir ) ; }
Deletes a directory and all contents including subdirectories and files

@param string $file
@return boolean
Deletes a directory and all contents including subdirectories and files