Re: [PHP] Re: get line from file
On Friday 19 July 2002 15:43, Peter wrote: > You can try this. > > > $datafile = file("..."); // Here comes your filename > > for ($k=0; $k<=count($datafile)-1; $k++) { > > echo "$datafile[$k]"; // Display each line read from datafile > > } > > ?> foreach ($datafile as $line) { echo "$line"; } is a lot simpler and easier to understand. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* I stick my neck out for nobody. -- Humphrey Bogart, "Casablanca" */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: get line from file
I think more info is probably needed here. Is it always the literal string "line3" that you want to catch, or always the second last line? Some kind of regular expression solution is probably what you need. Michael On Fri, 19 Jul 2002, Peter wrote: > You can try this. > > > $datafile = file("..."); // Here comes your filename > > for ($k=0; $k<=count($datafile)-1; $k++) { > > echo "$datafile[$k]"; // Display each line read from datafile > > } > > ?> > > > "Yamin Prabudy" <[EMAIL PROTECTED]> schreef in bericht > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I got a file line like this > > > > > > This is a line1 > > this is a line2 > > this is a line3 > > this is a line4 > > > > > > > > > > how can i grep out the line1,line2,line3 ?? > > do anyone out there have any idea ? > > > > > > -- n i n t i . c o m php-python-perl-mysql-postgresql Michael Hall [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: get line from file
You can try this. "; // Display each line read from datafile } ?> "Yamin Prabudy" <[EMAIL PROTECTED]> schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I got a file line like this > > > This is a line1 > this is a line2 > this is a line3 > this is a line4 > > > > > how can i grep out the line1,line2,line3 ?? > do anyone out there have any idea ? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php