note 90163 deleted from function.gc-enable by danbrown
| From: | danbrown@php.net | Date: | Tue, 04 Aug 2009 18:49:28 +0000 |
| Subject: | note 90163 deleted from function.gc-enable by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159106@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
This feature allows you to reuse previously emptied variables by unset() or simply return to the
previous value of a variable.
Their mode of use:
<?php
// Start caching variables
gc_enable ();
$value = "Hello world";
echo $value. "</ br>";
$value = "Bye world";
echo $value. "</ br>";
// Load the variables into garbage "Previous"
$previous = gc_collect_cycles();
// Get the previous value of "value" with old 0.
// 0 is the previous value, that means I take the first value "garbage" of the variable.
$value = $previous ['value'] [0]
//Get empty the garbage collection variable to disallow from the memory.
gc_disable($previous);
echo $value. "</ br>";
/*
This would return:
Hello world
Bye world
Hello world
*/
?>