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" Link to comment https://forums.phpfreaks.com/topic/135595-solved-add-to-text-data-during-file-read/ 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; } Link to comment https://forums.phpfreaks.com/topic/135595-solved-add-to-text-data-during-file-read/#findComment-706431 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 Link to comment https://forums.phpfreaks.com/topic/135595-solved-add-to-text-data-during-file-read/#findComment-706432 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. Link to comment https://forums.phpfreaks.com/topic/135595-solved-add-to-text-data-during-file-read/#findComment-706433 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.