Readme Posted March 3, 2012 Share Posted March 3, 2012 I need PHP script I have test.txt file and content is: Cat Dog Bird PHP must find line 1 and line 3 and show up in browser. Cat Bird Eng not good but I hope you understand me. Very thanks. Link to comment https://forums.phpfreaks.com/topic/258198-read-line/ Share on other sites More sharing options...
QuickOldCar Posted March 3, 2012 Share Posted March 3, 2012 Best advice I can give. http://php.net/manual/en/function.file.php http://php.net/manual/en/function.fread.php A simple example. <?php //read a file $my_file = "test.txt"; if (file_exists($my_file)) { $data = file($my_file); echo $data[0]."<br />".$data[2]."<br />"; } else { echo "No $my_file exists"; } ?> Link to comment https://forums.phpfreaks.com/topic/258198-read-line/#findComment-1323525 Share on other sites More sharing options...
Readme Posted March 3, 2012 Author Share Posted March 3, 2012 Work and thanks. But echo $data[0]."<br />".$data[2]."<br />"; Can make something like: echo ($data,0,2,8,100); ??? Link to comment https://forums.phpfreaks.com/topic/258198-read-line/#findComment-1323529 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.