Re: ereg() help, plz
| From: | _lallous | Date: | Wed, 10 Oct 2001 10:06:02 +0000 |
| Subject: | Re: ereg() help, plz | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70610@lists.php.net to get a copy of this message | ||
if (preg_match("/(^(\.{1,2})$)|(head\.jpg)|(^tn_)/im", $file_name))
continue; // skip this file
.
.
.
"McShen" <hshen@crosswinds.net> wrote in message
news:20010715013739.79177.qmail@pb1.pair.com...
> hi,
>
> I wanna print out all files in a directory. But i wanna exclude ".", "..",
> "head.jpg", and all files that start with tn_
>
> Here is my script, but it didn't work. Please help me to solve this
problem.
> Thank You.
>
> ---------my script-----
> while ($file_name = readdir($dir2))
>
> if (($file_name!="." && $file_name!=".." &&
> $file_name!="head.jpg" &&
> $file_name!=ereg(^tn_,$file_name) ))
>
> $files[]=$file_name;
> }
>
> $numfiles = count($files);
>
> for ($i=$g; $i<$numfiles; $i++){
> echo $files[$i];
> }
>
> -----------------
>
>
>
>