Code Library
Home Submit Free Hosting Link To Us Contacts

PHP Remove line from file

PHP Remove line from file PHP PHP Remove line from file Download (.zip)



<?
$line = "1";
$file = "haha.txt";

function remline($line, $file) {
        $data = file($file);
        $open = fopen($file, 'w');
        for ($i=0; $i<=count($data)-1; $i++) if ($i != $line) { fwrite($open,$data[$i]); }
        fclose($open);
}

remline("1",$file);

?>






PHP Remove line from file