Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 14959

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!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>Checks the existence of a node in zookeeper synchronously</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="zookeeper.delete.html">Zookeeper::delete</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="zookeeper.get.html">Zookeeper::get</a></div>
 <div class="up"><a href="class.zookeeper.html">Zookeeper</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="zookeeper.exists" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Zookeeper::exists</h1>
  <p class="verinfo">(PECL zookeeper &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">Zookeeper::exists</span> &mdash; <span class="dc-title">Checks the existence of a node in zookeeper synchronously</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-zookeeper.exists-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">bool</span> <span class="methodname"><strong>Zookeeper::exists</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$watcher_cb</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
  ] )</div>

 </div>


 <div class="refsect1 parameters" id="refsect1-zookeeper.exists-parameters">
  <h3 class="title">Parameters</h3>
  <dl>

   
    <dt>
<code class="parameter">path</code></dt>

    <dd>

     <p class="para">
      The name of the node. Expressed as a file name with slashes separating ancestors of the node.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">watcher_cb</code></dt>

    <dd>

     <p class="para">
      if nonzero, a watch will be set at the server to notify the client if the node changes. The watch will be set even if the node does not
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-zookeeper.exists-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns true/false on success, and false on failure.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-zookeeper.exists-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   This method emits PHP error/warning when parameters count or types are wrong or fail to check the existence of a node.
  </p>
  <div class="caution"><strong class="caution">Caution</strong>
    <p class="para">
      Since version 0.3.0, this method emits <strong class="classname">ZookeeperException</strong> and it&#039;s derivatives.
    </p>
  </div>
 </div>


 <div class="refsect1 examples" id="refsect1-zookeeper.exists-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-5841">
   <p><strong>Example #1 <span class="methodname"><strong>Zookeeper::exists()</strong></span> example</strong></p>
   <div class="example-contents"><p>
     Check the existence of a node.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$zookeeper&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Zookeeper</span><span style="color: #007700">(</span><span style="color: #DD0000">'locahost:2181'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$path&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'/path/to/node'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$r&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$zookeeper</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exists</span><span style="color: #007700">(</span><span style="color: #0000BB">$path</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$r</span><span style="color: #007700">)<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'EXISTS'</span><span style="color: #007700">;<br />else<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'N/A&nbsp;or&nbsp;ERR'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>The above example will output:</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
EXISTS
</pre></div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-zookeeper.exists-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li class="member"><span class="methodname"><a href="zookeeper.get.html" class="methodname" rel="rdfs-seeAlso">Zookeeper::get()</a> - Gets the data associated with a node synchronously</span></li>
   <li class="member"><strong class="classname">ZookeeperException</strong></li>
  </ul>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="zookeeper.delete.html">Zookeeper::delete</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="zookeeper.get.html">Zookeeper::get</a></div>
 <div class="up"><a href="class.zookeeper.html">Zookeeper</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>