I have the following chunk of code. The ignore array contains directory names which should be ignored when outputed. However, there is a flaw in the logic that i cannot figure out, it doesnt work right at all, any suggestions? Thanks.
$ignore =
array(".","..","extlib","images","lib","plugins","schemas","search_templates","tmpl"
if ($handle = opendir('/path/to/folder/')) {
while (false !== ($file = readdir($handle))) {
if (is_dir($file)){
for ($i=0; $i<sizeof($ignore); $i++){
if (preg_match("/$file/i",$ignore[$i])) {
print "$file = $ignore[$i]<br>";
} else {
print "$file<br>";
}
}
}
}
closedir($handle);
}
$ignore =
array(".","..","extlib","images","lib","plugins","schemas","search_templates","tmpl"
if ($handle = opendir('/path/to/folder/')) {
while (false !== ($file = readdir($handle))) {
if (is_dir($file)){
for ($i=0; $i<sizeof($ignore); $i++){
if (preg_match("/$file/i",$ignore[$i])) {
print "$file = $ignore[$i]<br>";
} else {
print "$file<br>";
}
}
}
}
closedir($handle);
}