foreach cross checking IP's and echo'ing matches
<p>I'm trying to check if $userinfo[host] (a list of ip addresses) has ANY matches in visitors.txt file. If it is, echo the matching string(s)</p>

<p>Nothing seems to be echo'ed. No errors either.</p>

<p>Here is the basic txt file</p>

<pre><code>  208.54.22.144|1355385350
  208.54.14.235|1355386649
  69.151.178.16|1355386296
</code></pre>

<p>(EDITED STRING)</p>

<pre><code>$ips = file_get_contents('visitors.txt');
$ip_regex = '/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/';
foreach ($ips as $check){
preg_match($ip_regex, $check, $current_ip);
if ((strpos($userinfo['host'],$current_ip[0]) !== false)) {
echo $userinfo['host'];
}
}
</code></pre>
