Re: fgets???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Daniel Brown <parasane@xxxxxxxxx> wrote:

> On Feb 8, 2008 12:11 PM, Pastor Steve <smarquez@xxxxxxxxxxxxxxx>
> wrote:
> > I think I may have written the question wrong. I only want to
> display the
> > first line. It is a news story with a headline. I only want to
> display the
> > headline in the link.
> >
> > The output I want is:
> >
> > The
> >
> > But I am getting:
> >
> > The file looks like this.
> >
> > Does that make more sense?
> 
> <?
> $handle = fopen($filename);
> $data = fgets($handle);
> echo $data."\n";
> ?>
> 
>     So long as you don't do a while() loop or something similar,
> fgets() will only read the first line.
> 
> -- 
> </Dan>
> 
> Daniel P. Brown
> Senior Unix Geek
> <? while(1) { $me = $mind--; sleep(86400); } ?>
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


Another method....
 <?
 $data = file($filename);
 echo $data[0]."\n";
 ?>



---
Nirmalya Lahiri
[+91-9433113536]


      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux