Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read a text file line by line 1

Status
Not open for further replies.

SM777

Technical User
Mar 7, 2001
208
GB
I'm trying to convert from Perl to PHP. I have a script that reads in a CSV text file one line at a time. I can't seem to do it in PHP.

The read command want to read in the entire file, or just a few characters - it doesnt read line by line.

Is there an easy way to do this or do I have read in one character at a time until I get an End Of Line marker or something?
 

hi

u can use fgets ($fp,$length)
where $fp is a file pointer and $length is bytes to be read
the termnation is either the length provided , new line character or end of file whichever is earlier.

hope that will help u
regards

spookie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top