From c13ddb7992d6a5c0188c71d0b14ee8f6cd2a0800 Mon Sep 17 00:00:00 2001 From: "Jesus M. Castagnetto" Date: Fri, 4 Aug 2000 17:01:04 +0000 Subject: [PATCH] moved call_user_method from var.xml to classobj.xml git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@29605 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/classobj.xml | 69 ++++++++++++++++++++++++++++++++++++++++++ functions/var.xml | 69 ------------------------------------------ 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/functions/classobj.xml b/functions/classobj.xml index a41c45c3f9..f2eac1df66 100644 --- a/functions/classobj.xml +++ b/functions/classobj.xml @@ -388,6 +388,75 @@ Object leafy belongs to class spinach a subclass of Vegetable + + + call_user_method + + Call a user method on an specific object + + + + Description + + + mixed + call_user_method + + string + method_name + + object + obj + + mixed + parameter + + mixed + ... + + + + + 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. + + + +