|
Posted by Phil on 08/21/06 18:44
On Mon, 21 Aug 2006 18:15:04 GMT, John Rappold wrote...
>
>Hi,
>
>I could really use some fast help on this. I have two arrays.
>The first array is created from the following:
>
> $dirn = substr($file, 0, 6);
> $birn = substr($file, 7, 6);
> $fdate = substr($file, 14, 8);
> $period = substr($file, 23, 5);
> $cat = substr($file, 29, 3);
>
>$fields = array($dirn, $birn, $fdate, $period, $cat);
>
>Here's the second array:
>
>$badchars = array("-", "_");
>
>What I want to do is search through the $fields array and find any
>occurences of the characters in the $badchars array.
>
>I tried to use an example from some comments on the PHP manual strpos page,
>but I can't get this to work:
>$i=0;
>$offset=0
>$pos=false;
>if ($pos === false) {
>$pos = strpos($fields, $badchars[$i], $offset);
>echo "File Passed.<br> ";
>$i++;
>} else {
>rename($curpath, $badpath);
>echo "Bad file Moved<br>";
>$i++;
>}TIA for help on this.
>
>
You might need to do a "for" loop so all the items in your $badcahars array get
checked. It looks like you have $i defined as 0 and not checking the rest of
that array.
Phil
--
Newsguy - Basic Accounts - $39.95 / year
Navigation:
[Reply to this message]
|