jnerotrix Posted December 5, 2008 Share Posted December 5, 2008 is there a way so when you Use PHP to Read A Text File $myFile = "testFile.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); echo $theData; You Can add a $ to the Front of Every Line Read Like If the data in the file was name = "john" address = "that road" ip = "1.0.0.127" And Every time it reads a line it adds $ to the begining so it would read like this $name = "john" $address = "that road" $ip = "1.0.0.127" Quote Link to comment Share on other sites More sharing options...
trq Posted December 5, 2008 Share Posted December 5, 2008 foreach (file("testFile.txt") as $line) { echo '$' . $line; } Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 5, 2008 Author Share Posted December 5, 2008 How would i add that to the read text file code Quote Link to comment Share on other sites More sharing options...
trq Posted December 5, 2008 Share Posted December 5, 2008 I'm not sure what you mean. The code I provided would completely replace the code you posted. Quote Link to comment 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.