SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict blizzman24's Avatar
    Join Date
    Jul 2004
    Location
    Texas
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    does php require you to destroy objects before the end of script?

    In languages like c, you would need to destroy objects to prevent memory leaks and such... does PHP automatically handle all of this for you?

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by blizzman24 View Post
    In languages like c,
    Like C?? Does the native C language have objects? AFAIK, C++ has objects where OOP concept is.

    Quote Originally Posted by blizzman24 View Post
    does PHP automatically handle all of this for you?
    PHP Manual says:
    The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence.
    So not only for me , generally the objects are automatically destroyed for you as well.

    See more details here:
    http://www.php.net/manual/en/language.oop5.decon.php
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Enthusiast Boxer's Avatar
    Join Date
    Jan 2008
    Location
    Denver, Colorado
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's a really nice feature of PHP: you shouldn't care about destroying, closing, removing and other things that are purely for maintenance. You can just do what you need (create files, objects, arrays, open connections, etc, and PHP will close and wipe everything for you


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •