answersLogoWhite

0


Best Answer

Here is a simple example:

// contacts.txt

John,Smith,555-1234

Jane,Doe,555-6442

// reader.php

<?php

// file function turns each line in the file into a row in an array

$file = file('/path/to/contacts.txt');

foreach($file as $line){

$contact = explode(', ', $line);

print_r($contact);

}

?>

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can I read from file list of data?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What two sets of data does every folder and file on an NTFS partition list?

read and execute


What is meant by read and write txt in file handling?

read: moving data from file to memory write: moving data from memory to file


When reading data in a data file the data will be read?

in order it was written.


What is function of End-of-file?

It means 'no more data to read in this file'.


When you copy data from a file on a storage device into RAM you?

read to the file


What is data in link list?

Data in the link list could be anything, it could be user defined data types or standard data types. Like link list of a text file data could be list of strings.


Why would you need to convert a string to a numeric data type?

For example, to interpret user input; to read data from a text file or from some other program that produces the data as a string.For example, to interpret user input; to read data from a text file or from some other program that produces the data as a string.For example, to interpret user input; to read data from a text file or from some other program that produces the data as a string.For example, to interpret user input; to read data from a text file or from some other program that produces the data as a string.


What is the full meaning of LDF file in SQL?

list data filelog database file


Traditional file environment?

Traditional file environment is not well suited to save data in them. They make it difficult to read the data as they are more unstructed.


How do you open a data file?

You can use fstream header file to read and write in files. It has two main components ifstream: stream which you can use to read data, and ofstream which allows you to save in files. Use something like this:#include#includeusing std::ifstream;using std::cout;using std::endl;int main(){char fileName[] = "myfile.txt";//file to read fromifstream inData;//stream to read from myfile.txtint data = 0;//to read one number of type int (we assume that the file contains it)inData.open(fileName);//connect the stream to the fileif (inData.fail())//if coult not open the file, program will be closed{cout data;//read one number from the file and save it in data of type intcout


What are read only files?

Files that can only be read (data can be retirieved) are called read-only files. You cannot write any data into a read-only file (you cannot edit it).


What do you understand by a linked list in data structure?

link list is a process by which we can add one file with another