Hi suppose I do have a text file with these lines
name: Mathew Age : 32 Country : USA Location : California bla bla bla....
What I want is I want a php code which can read this file and display result to a webpage.
Hi suppose I do have a text file with these lines
name: Mathew Age : 32 Country : USA Location : California bla bla bla....
What I want is I want a php code which can read this file and display result to a webpage.
file() function reads a file into an array where one element represents a string in the file
Use this code (untested):
$fp = fopen('filename.php');
while (!eof($fp)) {
$line = fgets($fp);
// Add code to display the values how you want
echo $line."<br>";
}
fclose($fp);
That will loop through the file line by line. Each line will be assigned to the $line variable, and then you can manipulate and display the values how you would like.