[KLUG Members] Best way to use temp files in PHP

members@kalamazoolinux.org members@kalamazoolinux.org
Mon, 9 Sep 2002 09:56:22 -0400


I have a PHP object, columnar report.  This lets me define columns (width, data
types, justification, etc...) and then go about pumping to full of rows.  Once
it is full I can do things like sort by a column, and then finally dump it to
some kind of output.  This works great.

But...

internall it holds all this information in an array.  So I've got a report with
15 columns of various types, and a heck of alot of rows.  At about ~40,000 rows
I hear "Ahhhhhhhhhhhhhhhhhhhhhhhhhhhh!" as a temporal rift occurs to some hell
dimension and my PHP process topples into it.  So I'm thinking I just can't have
arrays that big.

So maybe the answer is I should write all this to a temporary file.  But I'd
like to still maintain the `intelligence' of an array with its self described
structure and sort-ability.  If anyone has any tips on the best way to go about
this I'm all ears (actually, they are still ringing from PHP's cries of agony).