Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

reading a string from a file

General discussions related to php

Moderators: macek, egami, gesf

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
LTLhawk
New php-forum User
New php-forum User
 
Posts: 29
Joined: Fri Mar 07, 2003 4:17 pm

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.
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

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

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


Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.