note 49779 deleted from function.strstr by thiago

From: Date: Tue, 28 Oct 2008 13:47:37 +0000
Subject: note 49779 deleted from function.strstr by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145873@lists.php.net to get a copy of this message
Note Submitter: redzia ---- Example usage of fopen to remove line containing a key string <? $key = "w3ty8l"; //load file into $fc array $fc=file("some.txt"); //open same file and use "w" to clear file $f=fopen("some.txt","w"); //loop through array using foreach foreach($fc as $line) { if (!strstr($line,$key)) //look for $key in each line fputs($f,$line); //place $line back in file } fclose($f); ?>

« previous php.notes (#145873) next »