Saturday, 28 September 2013

Why is this echoing the values that don't match?

Why is this echoing the values that don't match?

I believe I am setting the if(strpos()); correctly. I've tried setting in
a else{}; and elseif {}; after seeing it in a few examples, but they
prompted for unexpected '}' and so forth.
<?php
$extension = '.com';
$lines = file('testdomains.txt');
foreach($lines as $line)
{
// Check if the line contains the string we're looking for, and print if
it does
if(strpos($line, $extension) !== false)
$line = preg_replace('/12:00:00 AM,AUC\b/','<br />', $line);
$line = preg_replace('/,9\/28\/2013/', '', $line);
echo $line;
}
?>

No comments:

Post a Comment