|
Posted by -Lost on 08/22/06 10:35
"John Rappold" <jrappold@jscoca-k12.org> wrote in message
news:IKmGg.20285$uV.15613@trnddc08...
> $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);
>
> $badchars = array("-", "_");
How about:
for($i = 0; $i < count($fields); $i++)
{
for($j = 0; $j < count($badchars); $j++)
{
if(strpos($fields[$i], $badchars[$j]) === false)
{
continue;
}
else
{
print $fields[$i] . ' contained ' . $badchars[$j] . '<br />' . "\n";
}
}
}
It may not be the most elegant solution, and using regular expressions might make it
considerably easier, but hey... it works efficiently.
-Lost
Navigation:
[Reply to this message]
|