reading a string from a file

General discussions related to php

Moderators: macek, egami, gesf

LTLhawk
New php-forum User
New php-forum User
Posts: 29
Joined: Fri Mar 07, 2003 4:17 pm

reading a string from a file

Postby LTLhawk » Mon Apr 28, 2003 8:42 am

Hi again,

I want to read some strings from a txt file. What is the best way to do this with php. fgets will get the entire line and fgetsc only gets a character...I want to read in each word as its own string....

thanks

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Tue Apr 29, 2003 2:30 am

$file_array = file("filename.txt");

that will read each line of the file into an array which is very convienent.

LTLhawk
New php-forum User
New php-forum User
Posts: 29
Joined: Fri Mar 07, 2003 4:17 pm

Postby LTLhawk » Tue Apr 29, 2003 3:25 am

ok thanks red


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest