Using PHP to Seperate Results of a txt file

Posted by outbreak on Stack Overflow See other posts from Stack Overflow or by outbreak
Published on 2012-03-23T20:47:30Z Indexed on 2012/03/23 23:29 UTC
Read the original article Hit count: 138

Filed under:
|
|

I am trying to display the last 10 lines of a File and from there take those results and break them down to 10 individual lines..

Currently the code I have found from examples is:

$filearray = file("test.txt");
$lastfifteenlines = array_slice($filearray,-10);

echo implode($lastfifteenlines, "\n")

It display's the 10 items I need however it does not break them down onto individual lines the current results are:

1.0.0.11 1.0.0.12 1.0.0.13 1.0.0.14 1.0.0.15

I need that to instead display as:

1.0.0.11 
1.0.0.12 
1.0.0.13 
1.0.0.14 
1.0.0.15

Thanks in Advance for the Asistance!

© Stack Overflow or respective owner

Related posts about php

Related posts about newline