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?

91 Like 5 Dislike
Previous php-forum Next php-forum
Other php-forum

quotes changing
hi all

in my content

opening quotes " changes to “

close qu

Querying info from one table based on info in another
Hi, I am currently trying to make a part for my user driven website where one user can subscribe to

Performance impact of cookies
Hi, I was just wondering what impact there would be in terms of performance if you where to set then

WORDPRESS - Multiple Loops Only Going to One Post?
I have various pages with multiple loops and i need them to be individual to all other categories.

why does my session end?
my connect.php starts the session just so you know
i can navigate arround my site fine except whe

Alternate messaging
I have 4 strings in MySQL db1

$string1 : Hello
$string2 : Hi
$string3 : Great
$strin

array_count_values question?
ok i'm trying to create a top ten list from a database of listed favorite movies.

the followi

asking for direction
I have 2 tables in my data, which are "post" and "event"
I won't make a summa

Upload, SSL and more php help
I recently just installed a ssl cert and do i use https for the whole site or just for the checkout.

PHP Array quick help
I need

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


if $_SESSION['username'] = "gay

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