You are here: Searching through an array « All PHP « IT news, forums, messages
Searching through an array

Posted by John Rappold on 08/21/06 18:15

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация