You may have encountered an error more similar to the below one very often
Allowed memory size of 134217728 bytes exhausted (tried to allocate 102400 bytes) in on line
If you ever encounter an error like this, just try to add a line like shown below at the top of your script
ini_set("memory_limit","32M");
This will set memory to be used by the script at 32MB instead of the default value that’s in php.in. You can also do the same by changing php.ini