<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Call a user method on an specific object [deprecated]</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.call-user-method-array.html">call_user_method_array</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.class-alias.html">class_alias</a></div> <div class="up"><a href="ref.classobj.html">Classes/Object Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.call-user-method" class="refentry"> <div class="refnamediv"> <h1 class="refname">call_user_method</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">call_user_method</span> — <span class="dc-title">Call a user method on an specific object [deprecated]</span></p> </div> <div class="refsect1 description" id="refsect1-function.call-user-method-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>call_user_method</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$method_name</code></span> , <span class="methodparam"><span class="type">object</span> <code class="parameter reference">&$obj</code></span> [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$parameter</code></span> [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$...</code></span> ]] )</div> <div class="warning"><strong class="warning">Warning</strong> <p class="para"> The <span class="function"><strong>call_user_method()</strong></span> function is deprecated as of PHP 4.1.0. </p> </div> </div> <div class="refsect1 parameters" id="refsect1-function.call-user-method-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">method_name</code></em></span> <dd> <p class="para"> The method name being called. </p> </dd> </dt> <dt> <span class="term"> <em><code class="parameter">obj</code></em> </span> <dd> <p class="para"> The <span class="type"><a href="language.types.object.html" class="type object">object</a></span> that <em><code class="parameter">method_name</code></em> is being called on. </p> </dd> </dt> <dt> <span class="term"> <em><code class="parameter">parameter ...</code></em> </span> <dd> <p class="para"> The optional parameters. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 examples" id="refsect1-function.call-user-method-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-5043"> <p><strong>Example #1 <span class="function"><strong>call_user_method()</strong></span> alternative</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />call_user_func</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$obj</span><span style="color: #007700">, </span><span style="color: #0000BB">$method_name</span><span style="color: #007700">), </span><span style="color: #0000BB">$parameter </span><span style="color: #FF8000">/* , ... */</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">call_user_func</span><span style="color: #007700">(array(&</span><span style="color: #0000BB">$obj</span><span style="color: #007700">, </span><span style="color: #0000BB">$method_name</span><span style="color: #007700">), </span><span style="color: #0000BB">$parameter </span><span style="color: #FF8000">/* , ... */</span><span style="color: #007700">); </span><span style="color: #FF8000">// PHP 4<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.call-user-method-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.call-user-func-array.html" class="function" rel="rdfs-seeAlso">call_user_func_array()</a> - Call a callback with an array of parameters</span></li> <li class="member"> <span class="function"><a href="function.call-user-func.html" class="function" rel="rdfs-seeAlso">call_user_func()</a> - Call the callback given by the first parameter</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.call-user-method-array.html">call_user_method_array</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.class-alias.html">class_alias</a></div> <div class="up"><a href="ref.classobj.html">Classes/Object Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>