ijsselg Posted February 13, 2013 Share Posted February 13, 2013 Hi, I want to read a file, and while reading I want to put the first line (before the first \n) in variable one second line in variabele two third line in variabele three. And I want to use it in html: $text = str_replace("\n","<br>",file_get_contents($file)); Anyone can help a little? Link to comment https://forums.phpfreaks.com/topic/274450-read-file-and-cut-text-in-peaces/ Share on other sites More sharing options...
AyKay47 Posted February 13, 2013 Share Posted February 13, 2013 Look into using fgets and store the lines into an array. Link to comment https://forums.phpfreaks.com/topic/274450-read-file-and-cut-text-in-peaces/#findComment-1412271 Share on other sites More sharing options...
ijsselg Posted February 13, 2013 Author Share Posted February 13, 2013 thanks! Link to comment https://forums.phpfreaks.com/topic/274450-read-file-and-cut-text-in-peaces/#findComment-1412278 Share on other sites More sharing options...
Barand Posted February 13, 2013 Share Posted February 13, 2013 Use file - it will put the lines into an array for you Link to comment https://forums.phpfreaks.com/topic/274450-read-file-and-cut-text-in-peaces/#findComment-1412342 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.