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

trouble printing an array....
I'm having some trouble printing out an array forwards. I'm figuring out the high and low of an arra

need help in update query
i create a form for update. there are 8 columns in my mysql table. on my main page all the data is r

cURL Upload Help
OK, I am creating a bridge from a local program to my website and I am trying to find the best way t

$variable = $variable
Hello

Sorry if this is a really simple question but I have run out of ideas. Is there a reall

function to return url
Hi,

Can you guys help me giving a function that takes all the contents in a particular field

Ajax Error since Upgrading to 3.5
Ever since upgrading my site to .NET 3.5 (I needed LINQ), I've been getting this annoying error on o

SQL Query/echo not working
Hey all,

I'm trying to run (what I thought) was a simple operation and it isn't working. I h

Code clarification
Hi

In the following code what could be the "search_print()" and where it could be

PHP Array quick help
I need

$_SESSION{'username'} to be like this:


if $_SESSION['username'] = "gay

News script
Hi ...

I am not sure if this is the rite place to post this but if its not sorry

i am

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