PDA

View Full Version : php glob() returns an empty array



epicoder
May 12th, 2010, 07:14 PM
For some reason, whenever I use glob() to search a directory for files, it will always return an empty array. To see if I had a syntax error, I made this very small test snippet...

<?php
foreach(glob('*.txt') as $file)
{
echo $file."\n";
}
?>
and put it in a directory with two text files in it. glob() still returned an empty array.

roccivic
May 12th, 2010, 09:01 PM
It's probably no consolation to you, but your snippet works just fine here.
Dunno, maybe reinstall PHP?

epicoder
May 12th, 2010, 09:18 PM
Hmmm.... Now it works again. Weird.