Hello everyone! Content of the text file (test.txt): 115.5.108.249 2015-03-01 118.110.6.87 2018-01-03 36.120.105.13 2018-04-06 I'm familiar with the following: <?php $fname = "test.txt"; $date = date("Y-m-d"); foreach($lines as $line) if(!strstr($line, $date)) $out .= $line; $f = fopen($fname, "w"); fwrite($f, $out); fclose($f); ?> This command will only delete the line that contains the current server history and date ($date). I want this command to run in reverse. Line cleaner whose history (date) is old and no match with current server date (The server where PHP runs). I hope you understand what I mean. Thanks.
strstr
foreach($lines as $line) if(strpos($line, $date) !== false) $out .= $line;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)