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

Multi language - seo links
Im trying to figure out the best method to have a multi language website that will function with seo

update 2 columns by doing inner 2-column query
Hi,
is something like this possible?

update contract_all set col1,col2 =
(

shift numbers with paging
Hi

How would i be able to display 10 numbers 1 2 3 4 5 6 7 8 9 10
and when I click next

Expandable Post Code
Hi,

Hope you can help. Which currently I haven't upgraded to connect to a mysql server, so i

Gridview Not updating in Update Panel
I have a gridview, three dropdown list boxes, and a button on my form. What is displayed in the gri

weird problem
last time, i did post a topic concerning why my page sometime will load as blank page when using IE.

Unable to customise toolbar in FCK
How to login with SAPCPIC userid
I have changed the Password for SAPCPIC in Development Server for 000,001 and 100 client.
But w

Displaying an image using echo command
I had done a query on my database, one of the fields being an image reference to a directory where a

Restricted access to sub-folder in iis6 doesn't work?
Basically I'm trying to add restriction to sub-folder (which contains pdf) in web.config for iis6 as

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