acctman Posted February 21, 2009 Share Posted February 21, 2009 to call the function below, i include the file at the top and then use usr_delete_dir() but do I have to include $usrdir = '/temp/'; or do i put usr_delete_dir('/temp/'); function usr_delete_dir($usrdir) { if (is_dir($usrdir)) $dir_handle = opendir($usrdir); if (!$dir_handle) return false; while($file = readdir($dir_handle)) { if ($file != "." && $file != "..") { if (!is_dir($usrdir."/".$file)) unlink($usrdir."/".$file); else delete_directory($usrdir.'/'.$file); } } closedir($dir_handle); rmdir($usrdir); return true; } Link to comment https://forums.phpfreaks.com/topic/146289-solved-function-usage-question/ Share on other sites More sharing options...
thebadbad Posted February 21, 2009 Share Posted February 21, 2009 The latter. Simply declaring $usrdir won't feed it to the function; only if you run usr_delete_dir($usrdir) afterwards. Link to comment https://forums.phpfreaks.com/topic/146289-solved-function-usage-question/#findComment-768045 Share on other sites More sharing options...
Mchl Posted February 21, 2009 Share Posted February 21, 2009 If I understand your question correctly usr_delete_dir('/temp/'); should work. Although you can always do: $dirToDelete = '/temp/'; usr_delete_dir($dirToDelete); Link to comment https://forums.phpfreaks.com/topic/146289-solved-function-usage-question/#findComment-768046 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.