$d = dir('system/functions'); while (false !== ($filebase = $d->read())) { if ($filebase!== '.' || $filebase!== '..'){ // ΡΠ΅Π³ΠΎ-ΡΠΎ Π΄Π΅Π»Π°Π΅ΠΌ } } $d->close();
Did you even understand why your option does not work? Some kind of error knocks? Maybe just the rights to the directory need to be set appropriate?
UPD
Make a simple check and see if all the file paths are correct:
define("H", $_SERVER["DOCUMENT_ROOT"].'/'); function get_files($path, $mask = '*'){ $sdir = array(); // ΠΏΠΎΠ»ΡΡΠΈΠΌ Π²ΡΠ΅ ΡΠ°ΠΉΠ»Ρ ΠΈΠ· Π΄ΠΈΡΡΠ΅ΠΊΡΠΎΡΠΈΠΈ if (false !== ($files = scandir($path))){ foreach ($files as $i => $entry){ // Π΅ΡΠ»ΠΈ ΠΈΠΌΡ ΡΠ°ΠΉΠ»Π° ΠΏΠΎΠ΄Ρ
ΠΎΠ΄ΠΈΡ ΠΏΠΎΠ΄ ΠΌΠ°ΡΠΊΡ ΠΏΠΎΠΈΠΊΠ° if ($entry != '.' && $entry != '..' && fnmatch($mask, $entry)){ $sdir[] = $path.'/'.$entry; } } } return ($sdir); } var_dump( get_files(H.'system/functions', '*.php') );