Anthony Ritter wrote:
> I am trying to access a website that has tab delimited data and use
> PHP to open the file, read from the
> file for output.
> I'd like to then place this data into an array, loop through the
> array and output only the next to last record.
> Is there any way to loop through the following records - there are 96
> - and keep only the *next to last last one* (which would be the most
> current record) before hitting EOF.
> They store the records every 15 minutes for a 24 hour span.
> I do not need all 96 records - only the most current -  or - next to
> last - record.

Read the file with the file function ( This will
give you an array, with each element representing a line in the original
Pop the last element away ( twice. The second
time you do this, store the element you will gain (pop will return the
element it popped). There you have it...

In code:

$content = file(
array_pop( $content );
$current = array_pop( $content );


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to