note 100334 modified in function.scandir by danbrown

From: Date: Fri, 08 Oct 2010 17:40:22 +0000
Subject: note 100334 modified in function.scandir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173087@lists.php.net to get a copy of this message
We can do a select dir in a array <?php function mi_dir_list($a_path=".", $a_mask="*") { $dir = @ dir("$a_path"); //List files in images directory while (($file = $dir->read()) !== false) { if($file !="." && $file!=".." && fnmatch($a_mask, $file)) $l_vdir[] = $file; } $dir->close(); return($l_vdir); } $lv = mi_dir_list( "../pruebas/", "*.*"); print_r($lv); ?> --was-- We can do a select dir in a array function mi_dir_list($a_path=".", $a_mask="*") { $dir = @ dir("$a_path"); //List files in images directory while (($file = $dir->read()) !== false) { if($file !="." && $file!=".." && fnmatch($a_mask, $file)) $l_vdir[] = $file; } $dir->close(); return($l_vdir); } $lv = mi_dir_list( "../pruebas/", "*.*"); print_r($lv); http://php.net/manual/en/function.scandir.php

« previous php.notes (#173087) next »