<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.apcu.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.apcu-dec.php',
    1 => 'apcu_dec',
    2 => 'Decrease a stored number',
  ),
  'up' => 
  array (
    0 => 'ref.apcu.php',
    1 => 'APCu Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.apcu-clear-cache.php',
    1 => 'apcu_clear_cache',
  ),
  'next' => 
  array (
    0 => 'function.apcu-delete.php',
    1 => 'apcu_delete',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/apcu/functions/apcu-dec.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.apcu-dec" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">apcu_dec</h1>
  <p class="verinfo">(PECL apcu &gt;= 4.0.0)</p><p class="refpurpose"><span class="refname">apcu_dec</span> &mdash; <span class="dc-title">Decrease a stored number</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.apcu-dec-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>apcu_dec</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">$key</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">$step</code><span class="initializer"> = 1</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter reference">&$success</code><span class="initializer"> = ?</span></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">$ttl</code><span class="initializer"> = 0</span></span><br>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="simpara">
   Decreases a stored integer value.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.apcu-dec-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <dl>
   
    <dt><code class="parameter">key</code></dt>
    <dd>
     <span class="simpara">
      The key of the value being decreased.
     </span>
    </dd>
   
   
    <dt><code class="parameter">step</code></dt>
    <dd>
     <span class="simpara">
      The step, or value to decrease.
     </span>
    </dd>
   
   
    <dt><code class="parameter">success</code></dt>
    <dd>
     <span class="simpara">
      Optionally pass the success or fail boolean value to
      this referenced variable.
     </span>
    </dd>
   
   
    <dt><code class="parameter">ttl</code></dt>
    <dd>
     <span class="simpara">
      TTL to use if the operation inserts a new value (rather than decrementing an existing one).
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.apcu-dec-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="simpara">
   Returns the current value of <code class="parameter">key</code>&#039;s value on success,
    o <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.apcu-dec-examples">
  <h3 class="title">Esempi</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 <span class="function"><strong>apcu_dec()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"Let's do something with success"</span><span style="color: #007700">, </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">apcu_store</span><span style="color: #007700">(</span><span style="color: #DD0000">'anumber'</span><span style="color: #007700">, </span><span style="color: #0000BB">42</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #0000BB">apcu_fetch</span><span style="color: #007700">(</span><span style="color: #DD0000">'anumber'</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br />echo </span><span style="color: #0000BB">apcu_dec</span><span style="color: #007700">(</span><span style="color: #DD0000">'anumber'</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">apcu_dec</span><span style="color: #007700">(</span><span style="color: #DD0000">'anumber'</span><span style="color: #007700">, </span><span style="color: #0000BB">10</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">apcu_dec</span><span style="color: #007700">(</span><span style="color: #DD0000">'anumber'</span><span style="color: #007700">, </span><span style="color: #0000BB">10</span><span style="color: #007700">, </span><span style="color: #0000BB">$success</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$success</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">"Now, let's fail"</span><span style="color: #007700">, </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">, </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">apcu_store</span><span style="color: #007700">(</span><span style="color: #DD0000">'astring'</span><span style="color: #007700">, </span><span style="color: #DD0000">'foo'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$ret </span><span style="color: #007700">= </span><span style="color: #0000BB">apcu_dec</span><span style="color: #007700">(</span><span style="color: #DD0000">'astring'</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">$fail</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$ret</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$fail</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à
qualcosa simile a:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Let&#039;s do something with success
42
41
31
21
bool(true)
Now, let&#039;s fail

bool(false)
bool(false)</pre>
</div>
   </div>
  </div>
 </div>



 <div class="refsect1 seealso" id="refsect1-function.apcu-dec-seealso">
  <h3 class="title">Vedere anche:</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.apcu-inc.php" class="function" rel="rdfs-seeAlso">apcu_inc()</a> - Increase a stored number</span></li>
  </ul>
 </div>


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