call_user_method

(PHP 3>= 3.0.3, PHP 4 , PHP 5)

call_user_method --  бШГШБЮЕР ЛЕРНД СЙЮГЮММНЦН НАЗЕЙРЮ [СЯРЮПЕБЬЕЕ]

нОХЯЮМХЕ

mixed call_user_method ( string method_name, object obj [, mixed parameter [, mixed ...]])

Внимание

тСМЙЖХЪ call_user_method_array() СЯРЮПЕКЮ Я БШУНДНЛ 4.1.0: ХЯОНКЭГСИРЕ ТСМЙЖХЧ call_user_func() Я array(&$obj, "method_name") Б ЙЮВЕЯРБЕ ОЮПЮЛЕРПЮ ХЛЕМХ ТСМЙЖХХ.

бШГШБЮЕЛ ЛЕРНД method_name НАЗЕЙРЮ obj. мХФЕ ОПХБЕДЕМ ОПХЛЕП ХЯОНКЭГНБЮМХЪ ТСМЙЖХХ, Б ЙНРНПНИ ЛШ НОПЕДЕКЪЕЛ ЙКЮЯЯ, ЯНГДЮ╦Л ЕЦН НАЗЕЙР Х ХЯОНКЭГСЕЛ call_user_method() ДКЪ БШГНБЮ ЛЕРНДЮ print_info.

<?php
class Country {
    var
$NAME;
    var
$TLD;
    
    function
Country($name, $tld)
    {
        
$this->NAME = $name;
        
$this->TLD = $tld;
    }

    function
print_info($prestr = "")
    {
        echo
$prestr . "Country: " . $this->NAME . "\n";
        echo
$prestr . "Top Level Domain: " . $this->TLD . "\n";
    }
}

$cntry = new Country("Peru", "pe");

echo
"* Calling the object method directly\n";
$cntry->print_info();

echo
"\n* Calling the same method indirectly\n";
call_user_method("print_info", $cntry, "\t");
?>

яЛ. РЮЙФЕ call_user_func_array() Х call_user_func().


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