<!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>The setCallback purpose</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="eventlistener.getsocketname.html">EventListener::getSocketName</a></div> <div class="next" style="text-align: right; float: right;"><a href="eventlistener.seterrorcallback.html">EventListener::setErrorCallback</a></div> <div class="up"><a href="class.eventlistener.html">EventListener</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="eventlistener.setcallback" class="refentry"> <div class="refnamediv"> <h1 class="refname">EventListener::setCallback</h1> <p class="verinfo">(PECL event >= 1.2.6-beta)</p><p class="refpurpose"><span class="refname">EventListener::setCallback</span> — <span class="dc-title">The setCallback purpose</span></p> </div> <div class="refsect1 description" id="refsect1-eventlistener.setcallback-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>EventListener::setCallback</strong></span> ( <span class="methodparam"> <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$cb</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">$arg</code> <span class="initializer"> = <strong><code>NULL</code></strong></span> </span> ] )</div> <p class="para rdfs-comment"> Adjust event connect listener's callback and optionally the callback argument. </p> </div> <div class="refsect1 parameters" id="refsect1-eventlistener.setcallback-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"> <em><code class="parameter">cb</code></em> </span> <dd> <p class="para"> The new callback for new connections. Ignored if <strong><code>NULL</code></strong>. </p> <p class="para"> Should match the following prototype: </p> <div class="methodsynopsis dc-description"> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>callback</strong></span> ([ <span class="methodparam"> <span class="type"><a href="class.eventlistener.html" class="type EventListener">EventListener</a></span> <code class="parameter">$listener</code> <span class="initializer"> = <strong><code>NULL</code></strong></span> </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">$fd</code> <span class="initializer"> = <strong><code>NULL</code></strong></span> </span> [, <span class="methodparam"> <span class="type">array</span> <code class="parameter">$address</code> <span class="initializer"> = <strong><code>NULL</code></strong></span> </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">$arg</code> <span class="initializer"> = <strong><code>NULL</code></strong></span> </span> ]]]] )</div> <p class="para"> <dl> <dt> <span class="term"> <em><code class="parameter">listener</code></em> </span> <dd> <p class="para"> The <a href="class.eventlistener.html" class="classname">EventListener</a> object. </p> </dd> </dt> <dt> <span class="term"> <em><code class="parameter">fd</code></em> </span> <dd> <p class="para"> The file descriptor or a resource associated with the listener. </p> </dd> </dt> <dt> <span class="term"> <em><code class="parameter">address</code></em> </span> <dd> <p class="para"> Array of two elements: IP address and the <em class="emphasis">server</em> port. </p> </dd> </dt> <dt> <span class="term"> <em><code class="parameter">arg</code></em> </span> <dd> <p class="para"> User custom data attached to the callback. </p> </dd> </dt> </dl> </p> </dd> </dt> <dt> <span class="term"> <em><code class="parameter">arg</code></em> </span> <dd> <p class="para"> Custom user data attached to the callback. Ignored if <strong><code>NULL</code></strong>. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-eventlistener.setcallback-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="eventlistener.getsocketname.html">EventListener::getSocketName</a></div> <div class="next" style="text-align: right; float: right;"><a href="eventlistener.seterrorcallback.html">EventListener::setErrorCallback</a></div> <div class="up"><a href="class.eventlistener.html">EventListener</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>