constant

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 ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 12-20-2007
Jean Pierre Daviau
 
Posts: n/a
Default Re: constant

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";

?>


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:56 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0