NYCPHP Meetup

NYPHP.org

[nycphp-talk] Reading just a couple lines of a file?

leam leam at reuel.net
Wed Mar 26 06:27:38 EDT 2008


Is there a performance benefit and way to read just the first few lines
of a 5k-10k file? I'm dealing with 20-300 files at a time. 

Pseudo code would look something like this:

DirectoryIterator  (Thank you PHP CookBook!)
	for each file:
	open file to read
	match $title to stuff between title HTML tags
	put $title into an array based on catagory
	put filename into an array (index matches the $title array)
	close file

Go through the $title arrays in Catagory sequence
	Echo $Catagory
	sort $title array alphabetically
	echo "a href filename" $title "/a"

Leam





More information about the talk mailing list