<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1018528" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1018528</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/reset-variables-php#comment-1108953</link>
    <description> &lt;p&gt;They just went into a more advanced explanation of how the unset() function destroys variables.&lt;/p&gt;
&lt;p&gt;I&#039;m not an expert with this yet, but from what I&#039;ve learned:&lt;/p&gt;
&lt;p&gt;This acts the same way UNIX handles program text segments.  Multiple instances of a program may run, but they will all share the same text segment.  When the last intance of the program terminates, the text segment is then freed from memory.&lt;/p&gt;
&lt;p&gt;$variable = &quot;value&quot;;&lt;br /&gt;
$reference1 = &amp;amp;$variable;&lt;br /&gt;
$reference2 = &amp;amp;$variable;&lt;/p&gt;
&lt;p&gt;&quot;value&quot; is stored in a data segment somewhere in memory. $variable, $reference1, and $reference2 all point to that memory address.&lt;/p&gt;
&lt;p&gt;unset($reference1);&lt;/p&gt;
&lt;p&gt;I&#039;ve just blown up $reference1.  $reference1 has now been freed from memory.  But $variable and $reference2 still point to &quot;value&quot;.&lt;/p&gt;
&lt;p&gt;$reference2 = NULL;&lt;/p&gt;
&lt;p&gt;I&#039;ve just set all references to &quot;value&quot; to NULL.  They all still have reserved memory, but no value.&lt;/p&gt;
 </description>
     <pubDate>Wed, 15 May 2002 17:51:42 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1108953 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/reset-variables-php#comment-1108941</link>
    <description> &lt;p&gt;This was taken from php.net&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;mailto:aulbach@unter.franken.de&quot; class=&quot;bb-email&quot;&gt;aulbach@unter.franken.de&lt;/a&gt;&lt;br /&gt;
26-Mar-2001 09:58 &lt;/p&gt;
&lt;p&gt;The docs for unset() should be changed in the following way:&lt;/p&gt;
&lt;p&gt;unset() destroys the specified variables. This means, that the REFERENCE&lt;br /&gt;
to the VALUE is destroyed, not the VALUE itself (in PHP4 every variable is&lt;br /&gt;
a reference to a value, see chapter &quot;references&quot;). PHP4 cleans&lt;br /&gt;
up the VALUE memory automatically for you, if no references to a value are&lt;br /&gt;
left.&lt;/p&gt;
&lt;p&gt;So be extremly careful if you unset() a variable with MORE THAN ONE&lt;br /&gt;
REFERENCE. Cause unset() clears only this reference, the remaining&lt;br /&gt;
references are not cleared! This means, that this results in different&lt;br /&gt;
values for two vars which has been referenced to one value after&lt;br /&gt;
unset()ing one of them.&lt;/p&gt;
&lt;p&gt;The prefered way to tell PHP, that an referenced var should be cleared is&lt;br /&gt;
to set it to the value NULL.  This will change the VALUE, and does not&lt;br /&gt;
delete the REFERENCE. Be careful, there are currently some (more or less&lt;br /&gt;
undocumented) discrepancies left in PHP, which will have perhaps bad side&lt;br /&gt;
effects.&lt;/p&gt;
&lt;p&gt;Please have a closer look to the &quot;references&quot;-chapter to&lt;br /&gt;
understand what could happen.&lt;/p&gt;
&lt;p&gt;PS: My personal opinion is, that PHP either lacks documentation or needs&lt;br /&gt;
some discussion in the way it interprets unset() and NULL and what will&lt;br /&gt;
happen with NULL-values.&lt;/p&gt;
 </description>
     <pubDate>Wed, 15 May 2002 10:12:33 +0000</pubDate>
 <dc:creator>shanda</dc:creator>
 <guid isPermaLink="false">comment 1108941 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/reset-variables-php#comment-1108938</link>
    <description> &lt;p&gt;To destroy a variable (free the memory), use:&lt;br /&gt;
unset($var);&lt;/p&gt;
&lt;p&gt;PHP Docs:&lt;br /&gt;
&lt;a href=&quot;http://www.php.net/manual/en/function.unset.php&quot; class=&quot;bb-url&quot;&gt;unset()&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Argh! And now you&#039;ve made me thirsty!&lt;/p&gt;
&lt;p&gt;I&#039;m not really Halle Berry.  I&#039;m Barry Bostwick!&quot; &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 15 May 2002 07:00:39 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1108938 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/reset-variables-php#comment-1108931</link>
    <description> &lt;p&gt;lol... Caffeine to the rescue!&lt;/p&gt;
 </description>
     <pubDate>Wed, 15 May 2002 01:38:16 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1108931 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/reset-variables-php#comment-1108929</link>
    <description> &lt;p&gt;After a Pepsi break, once again I&#039;ve answered my own question:&lt;/p&gt;
&lt;p&gt;$reset_array = array();&lt;/p&gt;
&lt;p&gt;Just set the array to an empty array when the line of code is reached.  duh!&lt;/p&gt;
 </description>
     <pubDate>Tue, 14 May 2002 23:33:18 +0000</pubDate>
 <dc:creator>shanda</dc:creator>
 <guid isPermaLink="false">comment 1108929 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
