|
Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://oit.cmc.msu.ru/php/function.call-user-method.html
Дата изменения: Sun Feb 3 22:35:18 2002 Дата индексирования: Mon Oct 1 22:06:42 2012 Кодировка: |
Calls a the method referred by method_name from the user defined obj object. An example of usage is below, where we define a class, instantiate an object and use call_user_method() to call indirectly its print_info method.
<?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");
?> |
See also call_user_func_array(), call_user_func(), call_user_method_array().