Empty text file when there is over XXXX lines of text.


Posted on 16th Feb 2014 07:03 pm by admin


define("RANDOM_FILE","/public_html/random.txt");
$randomEntry = "This goes in text file.n";
{
$randomFile = fopen(RANDOM_FILE,"a");
}
fwrite($randomFile,$randomEntry);
fclose($randomFile);


This adds text to a random.txt file. How do you make it also empty the file when there is over say 1,000 lines of data?

Each line has 588 bytes of data, or 588K when it has 1,000 lines. How big does a text file need to be before it can slow the site down when the script looks for the random line?

No comments posted yet

Your Answer:

Login to answer
91 Like 5 Dislike
Previous forums Next forums
Other forums

Hit counter updating once per IP - IP HIT COUNTER
I have a hit counter, for the amount of views on a tutorial.
It'll do the query and then do..

onclick problem
I have <input type="text" name="message">
<a href=page2.

Refining of search Criteria
Dear Friends

I need a help, I have a search page which of cars related, which has different s

having probem inserting data into db table
hi

i have a table with following columns in it
Code: candidate_id, degree, cgpa, institute

Best PHP Documentation generator
Hello guys!

I would like to hear from you what is the best PHP documentation generator. Perso

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash