This is a discussion on constant within the alt.comp.lang.php forums, part of the PHP Programming Forums category; With object flush it seems to work. <?php class Registre { private static $leRegistre = array(); private static $tmp = array(); public ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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"; ?> |
![]() |
| Thread Tools | |
| Display Modes | |
|
|