PHP Doku:: Object Aggregation Funktionen - ref.objaggregation.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzVariablen- und typbezogene ErweiterungenObject Aggregation/Composition [PHP 4]Object Aggregation Funktionen

Ein Service von Reinhard Neidl - Webprogrammierung.

Object Aggregation/Composition [PHP 4]

<<Beispiele

aggregate_info>>


UnterSeiten:

Object Aggregation Funktionen

Inhaltsverzeichnis


3 BenutzerBeiträge:
- Beiträge aktualisieren...
kencomer at NOSPAM dot kencomer dot com
20.09.2005 18:04
For PHP5 applications, the all of the "aggregate" function family is now in runkit.

  http://php.net/manual/en/ref.runkit.php
Jeb.
17.01.2003 11:18
It is worth noting that class association does not work, even in PHP 4.3.0 - this ability is experimental. I'm assuming it was added in for the sake of forwards-compatibilty. Use object association instead for now.

Until it is implemented, you will receieve a parse error when attempting to use it.

Related bug report: http://bugs.php.net/bug.php?id=20531

Just to prevent people posting about "why it doesn't work??", etc etc etc.
Greg Beaver firstname at chiaraquartet dot net
5.01.2003 0:54
If you need to serialize an object for sessions or other purposes, and want to save aggregation state, extend it from a base class such as this one, and use $this->agg/$this->unagg instead of aggregate/deaggregate

<?php
class base
{
    var
$_aggregates = array();
   
    function
agg($agg)
    {
       
aggregate($this,$agg);
       
$this->_aggregates[$agg] = 1;
    }
   
    function
unagg($agg = false)
    {
        if (
$agg)
        {
            
deaggregate($this,$agg);
             unset(
$this->_aggregates[$agg]);
        } else
        {
            
deaggregate($this);
           
$this->_aggregates = array();
        }
    }
}
?>



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)