This is probably terribly simple...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ryuujin7619
Forum Newbie
Posts: 2
Joined: Thu Feb 24, 2005 11:34 am

This is probably terribly simple...

Post by ryuujin7619 »

I was wondering if there was a way to read an entire file into an array, like the perl construction:

Code: Select all

open(FILE, "filename");
  @data = <FILE>;
  close(FILE);
Is there a good wqay to do this in PHP, or would I have to parse through the entire file line by line?

Thanks for your help!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

read the manual.

file()
ryuujin7619
Forum Newbie
Posts: 2
Joined: Thu Feb 24, 2005 11:34 am

Post by ryuujin7619 »

I was reading the manual, I must have just missed that page. Thank you for your help.
User avatar
smpdawg
Forum Contributor
Posts: 292
Joined: Thu Jan 27, 2005 3:10 pm
Location: Houston, TX
Contact:

Post by smpdawg »

Don't feel bad, I missed it too. ;)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it's somewhat understandable.. the function name isn't exactly informative, nor suggestive of it's nature.. plus it's real short :lol:

no big deal, either way.
User avatar
smpdawg
Forum Contributor
Posts: 292
Joined: Thu Jan 27, 2005 3:10 pm
Location: Houston, TX
Contact:

Post by smpdawg »

feyd - I've been meaning to ask you if you ever sleep LOL. I see post after post all the time from you but I have learned a lot from being on here.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

there's a few hours I sleep.. not many :D

although my online time here should drop in the next six months (starting school.. again) weee..

but enough off topic nonsense..


although patrik will testify that I'm a robot/clone. :)
Post Reply