lill87 Posted May 11, 2007 Share Posted May 11, 2007 Im currently making a MMORPG using PHP and I could use a little help! How do I make a "file_get_contents" or some other read file code to read from a certain LINE in the file. example: expect that "monster.php" looks like this (numbers as lines): 1: monstername 2: strength 3: gold Now, I want to read line 2 to read the text: strength, is that possible ??? Please reply how to make this, or any other solutions. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/50944-file-handling/ Share on other sites More sharing options...
only one Posted May 11, 2007 Share Posted May 11, 2007 $lines = file("url"); foreach ($lines as $line_num => $line) { if($line_num=the number){ echo "$line_num: $line<br />"; } Link to comment https://forums.phpfreaks.com/topic/50944-file-handling/#findComment-250584 Share on other sites More sharing options...
lill87 Posted May 11, 2007 Author Share Posted May 11, 2007 Thanks, solved my problems Link to comment https://forums.phpfreaks.com/topic/50944-file-handling/#findComment-250589 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.