get_parent_class

(PHP 4 , PHP 5)

get_parent_class -- бНГБПЮЫЮЕР ХЛЪ ЙКЮЯЯЮ АЮГНБНЦН ДКЪ НАЗЕЙРЮ ХКХ ЙКЮЯЯЮ

нОХЯЮМХЕ

string get_parent_class ( mixed obj)

еЯКХ obj, ТСМЙЖХЪ БНГБПЮЫЮЕР ХЛЪ ЙКЮЯЯЮ АЮГНБНЦН ДКЪ ЙКЮЯЯЮ, ЩЙГЕЛОКЪПНЛ ЙНРНПНЦН ЪБКЪЕРЯЪ obj.

еЯКХ obj ЪБКЪЕРЯЪ ЯРПНЙНИ, ТСМЙЖХЪ БНГБПЮЫЮЕР ХЛЪ ЙКЮЯЯЮ АЮГНБНЦН ДКЪ ЙКЮЯЯЮ Я ЩРХЛ ХЛЕМЕЛ. щРЮ БНГЛНФМНЯРЭ АШКЮ ДНАЮБКЕМЮ Б PHP 4.0.5.

Пример 1. оПХЛЕП ХЯОНКЭГНБЮМХЪ get_parent_class()

<?php

class dad {
    function
dad()
    {
    
// ХЛОКЕЛЕМРЮЖХЪ ВЕЦН-КХАН
    
}
}

class
child extends dad {
    function
child()
    {
        echo
"I'm " , get_parent_class($this) , "'s son\n";
    }
}

class
child2 extends dad {
    function
child2()
    {
        echo
"I'm " , get_parent_class('child2') , "'s son too\n";
    }
}

$foo = new child();
$bar = new child2();

?>

БШБНД:

I'm dad's son
I'm dad's son too

яЛ. РЮЙФЕ get_class() Х is_subclass_of().


HIVE: All information for read only. Please respect copyright!
Hosted by hive йца: йХЕБЯЙЮЪ ЦНПНДЯЙЮЪ АХАКХНРЕЙЮ