Posted by Jean Pierre Daviau on 12/20/07 18:59
With object flush it seems to work.
<?php
class Registre {
private static $leRegistre = array();
private static $tmp = array();
public static function getProperty($val) {
$num = array_search($val, self::$leRegistre);
return self::$leRegistre[$num];
}
public static function getRegistre() {
return self::$leRegistre;
}
public static function popRegistre($val) {
ob_start();
$i = 0;
$num = array_search($val, self::$leRegistre);
foreach(self::$leRegistre as $key=>$val) {
if($key == $num) continue;
self::$tmp[$i] = $val;
$i++;
}
self::$leRegistre = self::$tmp;
self::$tmp = null;
ob_flush();
}
public static function pushRegistre($value) {
self::$leRegistre[] = $value;
print_r(self::$leRegistre);
}
}
class info1{
public $_INumber;
public $members;
public $methods;
function __construct() {
Registre::pushRegistre(__CLASS__ . ' #' . rand());
}
function __destruct() {
Registre::popRegistre($this->unique_ID);
}
}
$a = new info1();
$b = new info1();
$a = null;
echo "-----\n";
print_r(Registre::getRegistre()) ;
echo "-----\n";
?>
Navigation:
[Reply to this message]
|