The array is probably reversed so files are deleted before directories. --
Kris Wallsmith | Community Manager kris.wallsm...@symfony-project.com Portland, Oregon USA http://twitter.com/kriswallsmith On Mar 2, 2009, at 1:29 PM, cirpo wrote: > > Hi, > i'm trying to find an "elegant" solution to delete files from the > filesystem and i was looking inside symfony base code and i discovered > the sfFilesystem class. > This class is used for exmple by the Clear Cache task and i was > wondering if it could be useful for my purpose and i'm a little > confused with this code(sfFileystem.class.php line 123) > - public function remove($files) > { > if (!is_array($files)) > { > $files = array($files); > } > > $files = array_reverse($files); > > > foreach ($files as $file) > { > if (is_dir($file) && !is_link($file)) > { > $this->logSection('dir-', $file); > > rmdir($file); > }[...] > > why array_reverse is called? I can't understand. > > thanks > > cirpo > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---