🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.php
Article #55

Re: How do I do this?

#55
From: Darryl Catchpole
Date: Wed, 23 May 2001 22:53
24 lines
1902 bytes

On Wed, 23 May 2001, Jan- wrote:

> I want to display only the last line of a txt-file.
> Ex. I have a txt-file named 'lines.txt' and it contains this:
> 
> This is line one
> This in line two
> This is line three
> 
> 
> Now I wanna make a php script that only displays the last line so only 'This
> is line three'.
> How do I do this, is it possible?


<?
	
   $foo = file("contact.html");
   $lastline = count($foo) - 1;
   echo "Lastline $lastline : " . $foo[$lastline]  . "<br>\n";

?>
Technical Details
Message-ID: <Pine.LNX.4.10.10105232344090.21665-100000@paulweller.cottage>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!skynet.be!dispose.news.demon.net!demon!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news2-win.server.ntlworld.com.POSTED!localhost!darryl
References: <kZWO6.8315$FL1.909094@afrodite.telenet-ops.be>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10f92b,39486179625bfc13
X-Google-Attributes: gid10f92b,public
X-Google-Thread: f9981,39486179625bfc13
X-Google-Attributes: gidf9981,public
X-Google-Thread: 1156bd,39486179625bfc13
X-Google-Attributes: gid1156bd,public
X-Google-Thread: 1107bb,39486179625bfc13
X-Google-Attributes: gid1107bb,public
X-Google-ArrivalTime: 2001-05-23 16:05:21 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!skynet.be!dispose.news.demon.net!demon!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news2-win.server.ntlworld.com.POSTED!localhost!darryl
Newsgroups: alt.comp.lang.php,alt.php,cz.comp.lang.php,de.comp.lang.php
From: Darryl Catchpole <darryl@work-smarter.co.uk>
X-Sender: darryl@paulweller.cottage
Subject: Re: How do I do this?
In-Reply-To: <kZWO6.8315$FL1.909094@afrodite.telenet-ops.be>
Message-ID: <Pine.LNX.4.10.10105232344090.21665-100000@paulweller.cottage>
References: <kZWO6.8315$FL1.909094@afrodite.telenet-ops.be>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Lines: 27
Date: Wed, 23 May 2001 23:53:27 +0100
NNTP-Posting-Host: 62.253.84.13
X-Complaints-To: abuse@ntlworld.com
X-Trace: news2-win.server.ntlworld.com 990658812 62.253.84.13 (Thu, 24 May 2001 00:00:12 BST)
NNTP-Posting-Date: Thu, 24 May 2001 00:00:12 BST
Organization: ntlworld News Service