note 94294 modified in function.scandir by danbrown

From: Date: Thu, 28 Jan 2010 14:11:57 +0000
Subject: note 94294 modified in function.scandir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-165438@lists.php.net to get a copy of this message
Another getDirectoryTree with filters: <?php function getDirectoryTree( $outerDir, $filters = array() ){ $dirs = array_diff( scandir( $outerDir ), array_merge( Array( ".", ".." ), $filters ) ); $dir_array = Array(); foreach( $dirs as $d ) $dir_array[ $d ] = is_dir($outerDir."/".$d) ? getDirectoryTree( $outerDir."/".$d, $filters ) : $dir_array[ $d ] = $d; return $dir_array; } ?> --was-- Another getDirectoryTree with filters: function getDirectoryTree( $outerDir, $filters = array() ){ $dirs = array_diff( scandir( $outerDir ), array_merge( Array( ".", ".." ), $filters ) ); $dir_array = Array(); foreach( $dirs as $d ) $dir_array[ $d ] = is_dir($outerDir."/".$d) ? getDirectoryTree( $outerDir."/".$d, $filters ) : $dir_array[ $d ] = $d; return $dir_array; } http://php.net/manual/en/function.scandir.php

« previous php.notes (#165438) next »