I create an output file called $output
which is a number of text lines with line breaks. These lines are created on a webpage for which I then use cURL to get the contents which are the essentially lines of text with line breaks.
I then create an array as follows:
$arrayoutput = explode("\n", $output);
This works quite good until the $output
file becomes so large I get the following error:
Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) ---> 128M
The $output
file is not always that big, but on occasion can be.
Now I do not want to increase memory levels or anything like that. I would like to be able to limit the maximimum length of the array.
Let's say, create the array with only, 100,000 lines maximum in it, or whatever to be within memory limits. When it reaches 100,000 elements, it stops.
Is it possible to do this?
-
0I haven't done that and don't have much time to mess with this at the moment (almost midnight here and I'm going to sleep) but a quick search yielded SplFixedArray. Maybe that will help you out at least to get on the right track. — Bogey
-
0What kind of reports are you trying to build for that size? lol — Zealous
-
0There is no max on the limit of an array. There is a limit on the amount of memory your script can use. — bruce-mesnekoff