开发者

do i need to use imagedestroy() in this loop?

I'm using the same variable to create a lot of images, so each one overrides the previous one. D开发者_Go百科o I need to use imagedestroy()?

ex:

<?php

foreach($paths as $path) {

    $image = imagecreatefrompng($path);
    //more code...
    imagedestroy($image); //--------> should i do this?
}
imagedestroy($image); //---------> or should i do this?


Depending on what you are doing exactly you should put imagedestroy() within the loop to free the memory and make space for the next images. On the other hand it just doesn't hurt

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜