Hi, a little question. I have this code, which is works perfect for files, but If am trying search on a directory name, the result is blank. How I can fix that?
<?php
function listdirs($dir,$search)
{
static $alldirs = array();
$dirs = glob($dir."*");
foreach ($dirs as $d){
if(is_file($d)){
$filename = pathinfo($d);
if(eregi($search,$filename['filename'])){
print "<a href=http://someurl.com/" . $d .">". $d . "</a><br/>";
}
}else{
listdirs($d."/",$search);
}
}
}
$path = "somedir/";
$search= "test";
listdirs($path,$search);
?>
somedir/test/
result: blank (I want: /somedir/test/)
somedir/test/test.txt
result: OK
I want to search also in the directory names, how I can do that?