П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 3439 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 5991 раз(а).

Учебник HTML.
Просмотров 3220 раз(а).

Руководство по PHP5.
Просмотров 5441 раз(а).

Хостинг через призму DNS.
Просмотров 4050 раз(а).

Подборка текстов стандартных документов.
Просмотров 55723 раз(а).

Учебник PHP - Самоучитель
Просмотров 3019 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 4803 раз(а).

Внешние атаки...
Просмотров 3758 раз(а).

Учебник PHP.
Просмотров 2782 раз(а).

SSI в примерах.
Просмотров 37395 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь





Руководство по PHP
Пред. След.

aggregate_info

(no version information, might be only in CVS)

aggregate_info --  Returns an associative array of the methods and properties from each class that has been aggregated to the object

Description

array aggregate_info ( object object )

Will return the aggregation information for a particular object as an associative array of arrays of methods and properties. The key for the main array is the name of the aggregated class.

For example the code below

Пример 1. Using aggregate_info()

<?php

class Slicer {
    var
$vegetable;

    function
Slicer($vegetable)
    {
        
$this->vegetable = $vegetable;
    }

    function
slice_it($num_cuts)
    {
        echo
"Doing some simple slicing\n";
        for (
$i=0; $i < $num_cuts; $i++) {
            
// do some slicing
        
}
    }
}

class
Dicer {
    var
$vegetable;
    var
$rotation_angle = 90;   // degrees

    
function Dicer($vegetable)
    {
        
$this->vegetable = $vegetable;
    }

    function
dice_it($num_cuts)
    {
        echo
"Cutting in one direction\n";
        for (
$i=0; $i < $num_cuts; $i++) {
            
// do some cutting
        
}
        
$this->rotate($this->rotation_angle);
        echo
"Cutting in a second direction\n";
        for (
$i=0; $i < $num_cuts; $i++) {
            
// do some more cutting
        
}
    }

    function
rotate($deg)
    {
        echo
"Now rotating {$this->vegetable} {$deg} degrees\n";
    }

    function
_secret_super_dicing($num_cuts)
    {
        
// so secret we cannot show you ;-)
    
}
}

$obj = new Slicer('onion');
aggregate($obj, 'Dicer');
print_r(aggregate_info($obj));
?>

Will produce the output

Array
(
[dicer] => Array
(
[methods] => Array
(
[0] => dice_it
[1] => rotate
)

[properties] => Array
(
[0] => rotation_angle
)

)

)
As you can see, all properties and methods of the Dicer class have been aggregated into our new object, with the exception of the class constructor and the method _secret_super_dicing

See also aggregate(), aggregate_methods(), aggregate_methods_by_list(), aggregate_methods_by_regexp(), aggregate_properties(), aggregate_properties_by_list(), aggregate_properties_by_regexp(), deaggregate()


Пред. Начало След.
Object Aggregation/Composition Functions Уровень выше aggregate_methods_by_list


Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru