Saturday, 28 September 2013

Strpos with both integer and word.

Strpos with both integer and word.

I'm stuck. Ignore the top line, no use for date yet, but will be using in
a bit. Having issues primarily with this line:
if(strpos($line, $extension) !== false and (preg_match('#\d#',$line !==
false))){
I'm trying to do is that if a domain name ($line) is a .com and has no
numbers then echo it. All of the preg_replace and strlen seems to be
working, but I can't get it to only perform the way I need. I need ot put
the preg_match outside of the <=40 rule as it may be causing confusion?
<?php
date_default_timezone_set('UTC');
$extension = '.com';
$lines = file('PoolDeletingDomainsList.txt');
echo "<b>4 Letter premiums for ". date("n/j/Y") .":</b><br />";
foreach($lines as $line)
if(strlen($line)<=40) {
{
// Check if the line contains the string we're looking for, and print if
it does
if(strpos($line, $extension) !== false and (preg_match('#\d#',$line !==
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