cgm225 Posted May 10, 2007 Share Posted May 10, 2007 How do I echo a single, specific line from a text file? Let's say, for example, the second line? Thank you all in advance! Link to comment https://forums.phpfreaks.com/topic/50757-how-to-echo-a-single-specific-line-from-a-text-file/ Share on other sites More sharing options...
neel_basu Posted May 10, 2007 Share Posted May 10, 2007 <?php $str = file_get_contents('file.txt'); $lines = explode("\n", $str);//Use \r\n Instead of \n if used on Windows echo $lines[1];//Secont Line ?> Link to comment https://forums.phpfreaks.com/topic/50757-how-to-echo-a-single-specific-line-from-a-text-file/#findComment-249535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.