what is the best way to check, if a value is NOT in an array? the purpose is to take results from a webpage and check one-by-one if they are in the txt file already. if they are not, i have to write them there.. If they are in there then i just want to leave them alone. this is what i came up with so far:
<?php $fp = fopen ('http://site.com', 'r'); for ($src = ''; !feof ($fp); $src .= fgets ($fp, 1024)); fclose ($fp); preg_match_all ('/\<td\>(.*)\<\/td\>/isU', $src, $sum, PREG_SET_ORDER); $i=0; $result=file('boot.txt'); while($sum[$i][1] && $i<50){ $word=$sum[$i][1]; if(in_array($word, $result)){} else{ $word = "\n".$word; $addtxt = fopen('boot.txt', 'a'); fputs($addtxt,$word); fclose($addtxt); } $i++; } ?> but somehow it still writes into the txtfile if if an identical line is already there. could somebody please correct the code or suggest a better option for checking? thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php