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! Quote 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 />"; } Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/50944-file-handling/#findComment-250589 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.