I'm not sure how to do this in php - need to calculate and delete an unspecified
number of lines from the *top* of a file.
<?php
//append $visitor to the bottom of $visdata
$fp = fopen($visdata, "a");
fwrite($fp, "\n".$visit or;)
//count the lines in $visdata
$lines = count($visdata) ;
if $lines > 10
{
//delete as many lines off the top as necessary
//to end up with 10 lines total in $visdata
}
fclose($fp);
?>
suggestions welcome! Thanks!
number of lines from the *top* of a file.
<?php
//append $visitor to the bottom of $visdata
$fp = fopen($visdata, "a");
fwrite($fp, "\n".$visit or;)
//count the lines in $visdata
$lines = count($visdata) ;
if $lines > 10
{
//delete as many lines off the top as necessary
//to end up with 10 lines total in $visdata
}
fclose($fp);
?>
suggestions welcome! Thanks!
Comment