<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 23 May 2013 09:41:46 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Stoimen Popov's Blog: PHP: Don't Call the Destructor Explicitly]]></title>
      <guid>http://www.phpdeveloper.org/news/17136</guid>
      <link>http://www.phpdeveloper.org/news/17136</link>
      <description><![CDATA[<p>
In <a href="http://www.stoimen.com/blog/2011/11/14/php-dont-call-the-destructor-explicitly/">this new post</a> to his blog <i>Stoimen Popov</i> talks about calling the "destructor" method of an object and why doing it directly could lead to some issues - like not actually destroying the object before the script ends.
</p>
<blockquote>
At the end of the script the interpreter frees the memory. Actually every object has a built-in destructor, just like it has built-in constructor. So even we don't define it explicitly, the object has its destructor. Usually this destructor is executed at the end of the script, or whenever the object isn't needed anymore. This can happen, for instance, at the end of a function body. Now if we call the destructor explicitly, which as I said I've seen many times, here's what happen. As you can see calling the destructor explicitly doesn't destroy the object. So the question is...how to destroy an object before the script stops?
</blockquote>
<p>
He points out that one way to "destroy" an object is to null it out and remove the structure from memory. This is tricky, though, because a clone of the object will still exist in memory, just not the original.
</p>]]></description>
      <pubDate>Wed, 16 Nov 2011 11:56:43 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Executing Destructors Manually in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/9623</guid>
      <link>http://www.phpdeveloper.org/news/9623</link>
      <description><![CDATA[<p>
Finishing off their series on destructors in PHP5 applications today, DevShed has posted <a href="http://www.devshed.com/c/a/PHP/Executing-Destructors-Manually-in-PHP-5/">this new tutorial</a> showing how to manually run the destructors of your class (in case there's ever a need).
</p>
<blockquote>
In this final tutorial of the series I'm going to show you how to manually trigger a destructor, and in addition you'll learn how to emulate the behavior of this magic method when using PHP 4.
</blockquote>
<p>
They not only talk about how to <a href="http://www.devshed.com/c/a/PHP/Executing-Destructors-Manually-in-PHP-5/1/">call the destructor</a> manually but they also show how to call multiple destructors at the same time to destroy lots of objects at once. And, as promised, they include <a href="http://www.devshed.com/c/a/PHP/Executing-Destructors-Manually-in-PHP-5/3/">a method</a> for being able to use a destructor-like bit of functionality in a PHP4 app as well.
</p>]]></description>
      <pubDate>Wed, 13 Feb 2008 11:27:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Retrieving Information on Several Objects with Destructors in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/9584</guid>
      <link>http://www.phpdeveloper.org/news/9584</link>
      <description><![CDATA[<p>
DevShed has posted the next-to-last (part four) of their series looking at destructors in PHP5 applications today. <a href="http://www.devshed.com/c/a/PHP/Retrieving-Information-on-Several-Objects-with-Destructors-in-PHP-5/">This time</a> they focus on passing information back out of the destructors as the script is finishing.
</p>
<blockquote>
In this fourth article of the series I'm going to teach you how perform this process when working with multiple objects (remember that you already learned how to achieve this using only one class instance).
</blockquote>
<p>
They start simple, showing how to <a href="http://www.devshed.com/c/a/PHP/Retrieving-Information-on-Several-Objects-with-Destructors-in-PHP-5/1/">handle one object</a> to give you a base to work from. They modify this to expand it out and show the management instead of three different user data objects.
</p>]]></description>
      <pubDate>Thu, 07 Feb 2008 10:28:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Keeping Track of Objects when Using Destructors in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/9527</guid>
      <link>http://www.phpdeveloper.org/news/9527</link>
      <description><![CDATA[<p>
Devshed continues their series looking at the use of destructors in PHP5 applications with <A href="http://www.devshed.com/c/a/PHP/Keeping-Track-of-Objects-when-Using-Destructors-in-PHP-5/">part three</a>, a method for keeping track of objects you've created during execution.
</p>
<blockquote>
In this third part of the series, I'm going to show you how to retrieve some useful information about a specific object, including its properties and methods, prior to its being destroyed by the PHP parser via the implementation of a simple destructor.
</blockquote>
<p>
Their new <a href="http://www.devshed.com/c/a/PHP/Keeping-Track-of-Objects-when-Using-Destructors-in-PHP-5/2/">user class</a> extracts the details about each of the objects right before they're destroyed via a call to get_object_vars and a loop to display the property and its value.
</p>]]></description>
      <pubDate>Wed, 30 Jan 2008 11:19:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Implementing Destructors with Multiple Objects in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/9479</guid>
      <link>http://www.phpdeveloper.org/news/9479</link>
      <description><![CDATA[<p>
DevShed has posted <a href="http://www.devshed.com/c/a/PHP/Implementing-Destructors-with-Multiple-Objects-in-PHP-5/">part two</a> in their series looking at the use of destructors in PHP5. This time they focus on their use with multiple objects inside of an application.
</p>
<blockquote>
Destructors can be used in all sorts of clever ways in the context of a given PHP 5 application, mostly in those cases where it's necessary to keep track of the status of certain objects prior to their being destroyed by the PHP interpreter. In this second chapter you'll learn how to work simultaneously with multiple classes that concretely implement their respective destructors.
</blockquote>
<p>
They revisit their previous example with a <a href="http://www.devshed.com/c/a/PHP/Implementing-Destructors-with-Multiple-Objects-in-PHP-5/1/">simple class</a> that's then extended to allow the flexibility to call the same destructor on multiple instances.
</p>]]></description>
      <pubDate>Wed, 23 Jan 2008 14:57:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Understanding Destructors in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/9442</guid>
      <link>http://www.phpdeveloper.org/news/9442</link>
      <description><![CDATA[<p>
DevShed has started up yet another PHP-related series today with <a href="http://www.devshed.com/c/a/PHP/Understanding-Destructors-in-PHP-5/">this new tutorial</a> covering part of PHP5's object functionality - destructors.
</p>
<blockquote>
This article, the first part of a five-part series, introduces you to destructors and their use with PHP 5 programs. [...] The word "destructor" relates to certain methods or functions of a determined programming language that are responsible for destroying data that, in the context of that particular language, shouldn't exist any longer.
</blockquote>
<p>
They create a <a href="http://www.devshed.com/c/a/PHP/Understanding-Destructors-in-PHP-5/1/">sample class</a> (for storing user information) and show how to integrate a destructor to remove all traces of the user's information from the properties of the class.
</p>]]></description>
      <pubDate>Thu, 17 Jan 2008 09:31:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Alex Netkachov's Blog: Optimize PHP memory usage: eliminate circular references]]></title>
      <guid>http://www.phpdeveloper.org/news/8676</guid>
      <link>http://www.phpdeveloper.org/news/8676</link>
      <description><![CDATA[<p>
On his blog today, <i>Alex Netkachov</i> has <a href="http://www.alexatnet.com/node/73">posted a suggestion</a> of how to combat a common issue facing PHP scripts - their memory usage.
</p>
<blockquote>
PHP has a build-in garbage collector so you do not need to track the links on the objects, allocate memory for objects and delete them when they are not longer necessary. Things seem so perfect that developers do not even know that their scripts allocate a lot of memory until their server stops processing requests because of the out of memory error.
</blockquote>
<p>
<a href="http://www.alexatnet.com/node/73">His example</a> is the processing of a parent/child relationship tree. If not managed correctly, the variables being used could get out of hand quite quickly. <i>Alex</i> recommends the use of a "destructor" at the end of each iteration to help destroy variables and values no longer needed.
</p>]]></description>
      <pubDate>Tue, 18 Sep 2007 17:17:21 -0500</pubDate>
    </item>
  </channel>
</rss>
