Jump to content

Recommended Posts

depends on where and how u r using it.

All variables are automatically unset after the script ends.

If you are overwriting and reusing variables and handle it efficiently then no need to unset, but if you referring them at many places and re-use or re-setting may cause confusion then unset() is safest..

 

As far as i know unset() will not slow down or fasten the speed as when u overwrite a variable it automatically gets unset first.

If you have a large variable that is no longer needed and your about to to set another large variable  then yes its worth it for the memory.. it really does depend on the script

but unsetting really to related to memory the cost of the CPU cycle to unset is normally worth the return in memory but if you have a single boolean variable it may not really be worth unsetting but if you have a image or large array then it is worth it..

 

Personally i only really unset the large variables, (of course their are exceptions)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.