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

Spliting paragraph into sentences and attach in
Here is what I am trying to do

example: Para1[123.456.789!] 3 sentences
Para2

help removing unwanted graphic
How do I remove the small elongated rectangular shape between the "Latest post" and "

Data storage spaces in varchar2
Trying to understand what's happening.
I am selecting a value from a table that is defined as c

Email Script does not reach destination
Hey Guys look at this code snippet :
Code:
//read a line from the file

$myFile = "

Download Image from URL and Upload it
Ok, I have been googling for the last 1/2 hour trying to figure this out, Most likely I'm just not s

check if string contain only a-z/A-Z
Is where any way to check if string contains only a-z/A-Z, without writing an array with all possibl

Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website

PHP Programming error. Please help!
Hi there,

Am making a website for a friend and have encountered a problem that i need fixing

php include email form with attachment
I have had no luck with finding a email form all over the Internet for various reasons. Some insecur

how do i make a string??
hey guys,
can someone please tell me how to put data from the glob function into a string

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