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

Google Map
I have done Google Map Integration for one my project. But for that we need the "latitude and l

mysql VARCHAR acting like INT
Hi, All.

I have a table that contains a varchar(10) column named weird_field. In this column

ClientScript.RegisterClientScriptBlock Issue
This is what I haveview plaincopy to clipboardprint?Protected Sub posrback_Click(ByVal sender As Obj

Help With editting and deleting form
Hallo !!

So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.pn

Bandwidth monitoring?
Hi guys,

I need a little information I have written a php app and I occurred to that I need

Mail sending is slow on server
Why mail is taking time to be send on apache-linux server

Send inserts to mysql thru port 80
Hi!

I have an application that must do some inserts in a mysql db. This db is behind a firewa

Shuffle Array
Hi,

I am writing a script for a game that needs players to randomly be assigned a target (ano

frame help
on the bottom frame is menu.html

Code: <body><form action='link.php' met

How to find OS bit version
How can I tell the person browsing my site is running 32, or 64 bit operating system?

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