I am trying to get a file in a directory. This operation must be very fast.The inital directory can have childrens like path/child/sub_child/sub_sub_child/aFile
. But a file can also be present before
Path
- Child
- A file
I do not care about which file I am getting I just want a fast way to get it.
I am stuck with this
$h = opendir($path); //Open the current directory
while (false !== ($entry = readdir($h)))
{
if($entry != '.' && $entry != '..')
{
echo $entry;
break;
}
}