tow php code cost double memory

I got a error to use a 2M string in php code.But the php settings memory limit is 8M.

Fatal error: Allowed memory size of **** bytes exhausted (tried to allocate *** bytes)

Then I check the php code, I find there are some codes cost more memory.

$tmp = “string”.$tmp.”string”;

I change those codes to:

$tmp = “string”.$tmp;

$tmp .= “string”;

It works!

Leave a Reply

You must be logged in to post a comment.