Most Referenced Functions
  » google_pagerank()
  » preg_replace()
  » imagecreatefrompng()
  » site_pageranks()
  » imagepng()
  » imagedestroy()
  » imagestring()
  » imagecolorallocate()
  » htmlentities()
  » preg_match()
  » fopen()
  » header()
  » getimagesize()
  » preg_match_all()
  » session_start()
  » htmlspecialchars()
  » ob_start()
  » ob_flush()
  » strstr()
  » flush()
  » strpos()
  » setcookie()
  » str_replace()
  » array2vars()
  » nl2br()
  » preg_split()
  » ereg()
  » ereg_replace()
  » urlencode()
  » readgzfile()

Become a sponsor for $15/month. Link is sitewide - PR5 homepage, 20+ PR4 pages, 90+ PR3 pages. Email dave[AT]icemelon[D0T]c0m.

PHP Functions

Function: call_user_method

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

call_user_method --  Call a user method on an specific object [deprecated]

Description

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

Warning

The call_user_method() function is deprecated as of PHP 4.1.0, use the call_user_func() variety with the array(&$obj, "method_name") syntax instead.

Calls 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");
?>

Related Function(s)

  • call_user_func()
  • call_user_func_array()
  • Icemelon -- PHP, CSS, Javascript Tutorials, & More!
      © 2005-2010 Icemelon.com   Email: dave[AT]icemelon[D0T]c0m