I am wondering is there a size limit for array in php 5? I wrote a php script to change the last element of each line in a file. print out the content of a modified file, wh
You could be running out of memory, as your array size is (in theory) only limited by the amount of memory allocated to the script.
Put ini_set('memory_limit', '1024M');
in the beginning of your script to set the memory limit to 1 GB. You may need to increase this even higher for best results.
As manyxcxi says you will probably have to increase the memory_limit. Sometimes you can also reduce memory usage by unsetting large variables with unset($var). This is only needed when the variable stays in scope far past it's last point of use.
Are you by any chance now reading the whole file, tranforming it and then writing the new file? If so you can reduce memory usage by working in a loop where you read a small part, process it and write it out and repeat that until you reach the end of the file. But only if the transformation algorithm doesn't need the whole file to transform a small part.