Advertisement
Guest User

Untitled

a guest
Oct 27th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2.  
  3. function getDirectory($path) {
  4.     $dir = $files = array();
  5.     $ite = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS);
  6.     foreach ( new RecursiveIteratorIterator($ite, RecursiveIteratorIterator::CHILD_FIRST) as $file ) {
  7.         $file->isDir() ? $dir[] = "$file" : $files[] = "$file";
  8.     }
  9.     return array($dir,$files);
  10. }
  11.  
  12. echo "<pre>";
  13. list($a,$b) = getDirectory(__DIR__);
  14. print_r ($a);   // this will result the same as array $files_matched, it ok!
  15. print_r ($b);   // but i don't know why I cannot get the array of $dir_matched??
  16. echo "</pre>";
  17.  
  18.  
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement