<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.zookeeper.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'zookeeper.create.php',
    1 => 'Zookeeper::create',
    2 => 'Create a node synchronously',
  ),
  'up' => 
  array (
    0 => 'class.zookeeper.php',
    1 => 'Zookeeper',
  ),
  'prev' => 
  array (
    0 => 'zookeeper.construct.php',
    1 => 'Zookeeper::__construct',
  ),
  'next' => 
  array (
    0 => 'zookeeper.delete.php',
    1 => 'Zookeeper::delete',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/zookeeper/zookeeper/create.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="zookeeper.create" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Zookeeper::create</h1>
  <p class="verinfo">(PECL zookeeper &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">Zookeeper::create</span> &mdash; <span class="dc-title">Create a node synchronously</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-zookeeper.create-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="methodname"><strong>Zookeeper::create</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$path</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$value</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$acls</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   This method will create a node in ZooKeeper. A node can only be created if it does not already exists. The Create Flags affect the creation of nodes. If ZOO_EPHEMERAL flag is set, the node will automatically get removed if the client session goes away. If the ZOO_SEQUENCE flag is set, a unique monotonically increasing sequence number is appended to the path name.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-zookeeper.create-parameters">
  <h3 class="title">Elenco dei parametri</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">value</code></dt>
    <dd>
     <p class="para">
      The data to be stored in the node.
     </p>
    </dd>
   
   
    <dt><code class="parameter">acls</code></dt>
    <dd>
     <p class="para">
      The initial ACL of the node. The ACL must not be null or empty.
     </p>
    </dd>
   
   
    <dt><code class="parameter">flags</code></dt>
    <dd>
     <p class="para">
      this parameter can be set to 0 for normal create or an OR of the Create Flags
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-zookeeper.create-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Returns the path of the new node (this might be different than the supplied path because of the ZOO_SEQUENCE flag) on success, and false on failure.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-zookeeper.create-errors">
  <h3 class="title">Errori/Eccezioni</h3>
  <p class="para">
   This method emits PHP error/warning when parameters count or types are wrong or fail to create node.
  </p>
  <div class="caution"><strong class="caution">Attenzione</strong>
    <p class="para">
      Since version 0.3.0, this method emits <span class="classname"><a href="class.zookeeperexception.php" class="classname">ZookeeperException</a></span> and it&#039;s derivatives.
    </p>
  </div>
 </div>


 <div class="refsect1 examples" id="refsect1-zookeeper.create-examples">
  <h3 class="title">Esempi</h3>
  <div class="example" id="zookeeper.create.example.basic">
   <p><strong>Example #1 <span class="methodname"><strong>Zookeeper::create()</strong></span> example</strong></p>
   <div class="example-contents"><p>
     Create a new node.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$zookeeper </span><span style="color: #007700">= new </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">$aclArray </span><span style="color: #007700">= array(<br />  array(<br />    </span><span style="color: #DD0000">'perms'  </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">Zookeeper</span><span style="color: #007700">::</span><span style="color: #0000BB">PERM_ALL</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'scheme' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'world'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'id'     </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'anyone'</span><span style="color: #007700">,<br />  )<br />);<br /></span><span style="color: #0000BB">$path </span><span style="color: #007700">= </span><span style="color: #DD0000">'/path/to/newnode'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$realPath </span><span style="color: #007700">= </span><span style="color: #0000BB">$zookeeper</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">create</span><span style="color: #007700">(</span><span style="color: #0000BB">$path</span><span style="color: #007700">, </span><span style="color: #0000BB">null</span><span style="color: #007700">, </span><span style="color: #0000BB">$aclArray</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$realPath</span><span style="color: #007700">)<br />  echo </span><span style="color: #0000BB">$realPath</span><span style="color: #007700">;<br />else<br />  echo </span><span style="color: #DD0000">'ERR'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Il precedente esempio visualizzerà:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">/path/to/newnode</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-zookeeper.create-seealso">
  <h3 class="title">Vedere anche:</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="zookeeper.delete.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::delete()</a> - Delete a node in zookeeper synchronously</span></li>
   <li><span class="methodname"><a href="zookeeper.getchildren.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::getChildren()</a> - Lists the children of a node synchronously</span></li>
   <li><a href="class.zookeeper.php#zookeeper.constants.perms" class="link">ZooKeeper Permissions</a></li>
   <li><span class="classname"><a href="class.zookeeperexception.php" class="classname">ZookeeperException</a></span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>