Ugh. Same thing for me, but I found the problem. For whatever reason, it was detecting the port for the last one as a string, not a integer. Try casting to int when adding to the array. Here's what worked for me:
<?php
$file = 'cvs.db';
$Content = file_get_contents($file);
$spfile = explode("|", $Content);
foreach($spfile as $keys) {
$ip_ports = explode (':', $keys);
$ips[] = $ip_ports[0];
$ports[] = (int)$ip_ports[1];
}
for($i=0;$i<count($ips);$i++){
if($open = fsockopen($ips[$i], $ports[$i], &$errno, &$errstr, 160)) {
echo $ips[$i].':'.$ports[$i]." Good\n";
}
else {
echo $ips[$i].':'.$ports[$i]." [No Good]\n";
}
fclose($open);
unset($open);
}
?>