Skip to content

Instantly share code, notes, and snippets.

@takuya
Created February 7, 2012 09:16
Show Gist options
  • Save takuya/1758509 to your computer and use it in GitHub Desktop.
Save takuya/1758509 to your computer and use it in GitHub Desktop.
ディレクトリ中のディレクトリ ref: http://qiita.com/items/2042
<?php
function scan_dir_in_dir($dir){
$cwd = getcwd();
chdir($dir);
$list = scandir("$dir/vendor") ;
foreach( $list as $idx=> $dirname){
if( $dirname == "." ){ unset($list[$idx] ); continue; }
if( $dirname == ".." ){ unset($list[$idx] ); continue;}
if( is_dir($dirname) === false ){ unset($list[$idx] ) ;continue;}
$list[$idx] = getcwd()."/".$dirname;
};
chdir($cwd);
if(!$list){return array();}
return $list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment