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

Legal Issues for SAP ERP o ERP in general
Hi experts,

Can someone please help me finding some documentation about legal issues tha

preg_match logical error
Code: <?php
$s = file_get_contents("page.html");
preg_match('/<div cla

Upload file and add HTML
Hey everyone,

I have a client has meeting agendas and minutes that should be posted online. I

does anyone know a php script to send mail using gmails/googles free smtp server
cause i heard u can do that but i dont know how

Converting numbers to months
The porgram works -just need the last function(month_convert_ to convert numbers to months -thanks.

PHP Multiples of 2, Show posts...not working (wordpress)
I have been using this code to show div.example with 6 li columns inside it, each li is a post with

login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php

EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules t

Vertical Alligning - Not working in 1 cell?
<?php

echo "<table id="valign" width="60%" style=

Exporting new records
Trying to figure out the best way to set this up.

People register my site.

Their prof

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