Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: aggregate - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

aggregation_info" width="11" height="7"/> <aggregate_properties
Last updated: Fri, 16 May 2008

view this page in

aggregate

(PHP 4 >= 4.2.0)

aggregate — メソッドおよびプロパティの動的なクラス/オブジェクト集約を行う

説明

void aggregate ( object $object , string $class_name )

既存のオブジェクトにあるクラスで定義されたメソッドとプロパティを集約します。 アンダースコア文字 (_) で始まるメソッドとプロパティは、 集約されたクラスではプライベートとみなされ、使用されません。 コンストラクタも集約処理から除外されます。

パラメータ

object

class_name

返り値

値を返しません。



add a note add a note User Contributed Notes
aggregate
kencomer at NOSPAM dot kencomer dot com
12-Sep-2005 01:22
For PHP5 applications, the aggregate functionality available through classkit has been incorporated into and replaced by runkit. Per the classkit page of the PHP manual:

"Note:  This extension has been replaced by runkit, which is not limited to class manipulation but has function manipulation, as well."

  http://php.net/manual/en/ref.runkit.php

Per the runkit page:

" This package is meant as a feature added replacement for the classkit package. When compiled with the --enable-runkit=classkit  option to ./configure, it will export classkit compatible function definitions and constants."
Matt Barry
29-Mar-2005 05:02
A note for those who may be implementing projects in PHP4 using aggregate(); these functions do not exist in PHP5.  For similar functionality, you can try using the Classkit extension:

http://us2.php.net/manual/en/ref.classkit.php
gmail pfayolle
08-Jan-2005 05:16
Note that even if this can be used to emulate multiple inheritance to some extent, an object in PHP can only be subclass of the class used in the class declaration and no other.

<?php

class A {}
class
B {}

class
C extends A
{
  function
C()
  {
   
aggregate($this, 'B'); // emulate multiple inheritance
 
}
}

$c = new C;
echo (int)
is_subclass_of($c, 'B');

/*
Output: 0
*/

?>
hewei at ied dot org dot cn
02-Mar-2003 08:34
YES you can use aggregation functions to simulate multiple inheritence.

function foo()
{
    aggregate($this, "bar");
    bar::bar();
}

 
show source | credits | sitemap | contact | advertising | mirror sites