reading a string from a file

General discussions related to php

Moderators: egami, macek, gesf

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

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: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

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

Tue Apr 29, 2003 3:25 am

ok thanks red

Post Reply