dear all,
i wrote this script, but there's an error with my script.
class firstclass {
var $tmpdir;
function definetemp() {
$this->tmpdir = "tmp";
}
function deltree($path) {
if (is_dir($path)) {
$entries = scandir($path);
foreach ($entries as $entry) {
if ($entry != '.' && $entry != '..') {
deltree($path.DIRECTORY_SEPARATOR.$entry);
}
}
rmdir($path);
}
else {
unlink($path);
}
}
}
$classone = new firstclass();
class secondclass {
function action(){
global $classone;
// ? -> this should do action of deltree function <- ?
$classone->deltree($classone->tmpdir);
}
function whatever(){
// ...
}
}
$classtwo = new secondclass();
// call action function
$classtwo->action();
thank you very much for any kind of help.
best regards