hi i want to delete all lines from old log files and keep fresh 50 lines which is at the bottom
plz give me the php code do something like this and if possible can we change the orientation of these lines
normal input
111111
2222222
3333333
44444444
5555555
output like
555555
4444444
3333333
22222
111111
to see the fresh log at top and 50 or 100 lines only
Thanks alot
Added Comment from below
Thanks alot but how to join it with this one ?
// set source file name and path
$source = "toi200686.txt";
// read raw text as array
$raw = file($source) or die("Cannot read file");
// join remaining data into string
$data = join('', $raw);
// replace special characters with HTML entities
// replace line breaks with <br />
$html = nl2br(htmlspecialchars($data));
it make the output as a html file, so how ur code will run with this properly ? Thanks