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
$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?