preg_match and ||
Posted: Sat Sep 23, 2006 8:32 am
i'm so imbarassed, but if i don't ask, i may go nuts....a while back you all helped introduce me to preg_match so i could pass over all those files that started with "." or "._"....i actually need to evolve that script to avoid the same files, and also other files (those with ".php", and ".txt)....i am trying to incorporate the || operator, but i am not having luck...am i going about this all wrong?
Code: Select all
<?php
$menuType=$_POST['menuType'];
$path=$_SERVER['SCRIPT_NAME'];
$directory="../project";
$tour=$_POST['tour'];
$openDir=opendir($directory);
$subpatterns=array("getDirs.php");
while(false!=($file=readdir($openDir))){
if(!preg_match('/^\./',$file))|| (!preg_match('/.php/',$file)){
$files.= "<pict>$file</pict>";
}
}
closedir($openDir);
echo ("&xml=<images>");
echo $files;
echo ("</images>&");
?>