how to properly destroy an array of images

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
elim
Forum Newbie
Posts: 8
Joined: Tue Jun 24, 2008 10:19 am

how to properly destroy an array of images

Post by elim »

We know

Code: Select all

ImageDestroy($anImg);
Is the way of destroy an image created by php code. But if I have an array of such images,
what's the proper way of destroy the array (give all the corresponding memories back to the system)?
Thanks for your anwser.

Can I just do
unset($imgArray);
???
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: how to properly destroy an array of images

Post by requinix »

unset should work, but in case it doesn't (quite possible),

Code: Select all

array_map("imagedestroy", $imgArray);
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: how to properly destroy an array of images

Post by pickle »

Ya, you should be able to just unset() the array.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply