i use a for
loop to unset all of the leftover variables in my script, to save some memory.
My question is, will unset($variable);
delete $variable
if it is a PHP gd resource, like the one created with $variable = imagecreatefrompng('url');
?
Asked
Active
Viewed 342 times
1

Mister_Fix
- 73
- 2
- 11
-
[This question should clarify things for you](http://stackoverflow.com/questions/584960/whats-better-at-freeing-memory-with-php-unset-or-var-null). – Andrei Apr 08 '15 at 20:56
-
you should use imagedestroy funtion, check http://php.net/manual/en/function.imagedestroy.php – kraysak Apr 10 '15 at 01:46
-
@kraysak I know i can do that but there's over 50 GD resources and i can't just go through each one of them, so i have a function that unsets all variables, some of those variables are PHP gd resources and i was wondering if unset could destroy those as well. – Mister_Fix Apr 11 '15 at 08:55