<!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>Decrements the value associated with the key</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.wincache-ucache-clear.html">wincache_ucache_clear</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.wincache-ucache-delete.html">wincache_ucache_delete</a></div> <div class="up"><a href="ref.wincache.html">WinCache Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.wincache-ucache-dec" class="refentry"> <div class="refnamediv"> <h1 class="refname">wincache_ucache_dec</h1> <p class="verinfo">(PECL wincache >= 1.1.0)</p><p class="refpurpose"><span class="refname">wincache_ucache_dec</span> — <span class="dc-title"> Decrements the value associated with the key </span></p> </div> <div class="refsect1 description" id="refsect1-function.wincache-ucache-dec-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>wincache_ucache_dec</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$dec_by</code><span class="initializer"> = 1</span></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter reference">&$success</code></span> ]] )</div> <p class="para rdfs-comment"> Decrements the value associated with the <em><code class="parameter">key</code></em> by 1 or as specified by <em><code class="parameter">dec_by</code></em>. </p> </div> <div class="refsect1 parameters" id="refsect1-function.wincache-ucache-dec-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">key</code></em></span> <dd> <p class="para"> The <em><code class="parameter">key</code></em> that was used to store the variable in the cache. <em><code class="parameter">key</code></em> is case sensitive. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">dec_by</code></em></span> <dd> <p class="para"> The value by which the variable associated with the <em><code class="parameter">key</code></em> will get decremented. If the argument is a floating point number it will be truncated to nearest integer. The variable associated with the <em><code class="parameter">key</code></em> should be of type <em>long</em>, otherwise the function fails and returns <strong><code>FALSE</code></strong>. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">success</code></em></span> <dd> <p class="para"> Will be set to <strong><code>TRUE</code></strong> on success and <strong><code>FALSE</code></strong> on failure. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.wincache-ucache-dec-returnvalues"> <h3 class="title">Return Values</h3> <p class="simpara"> Returns the decremented value on success and <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 examples" id="refsect1-function.wincache-ucache-dec-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-573"> <p><strong>Example #1 Using <span class="function"><strong>wincache_ucache_dec()</strong></span></strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />wincache_ucache_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'counter'</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">wincache_ucache_dec</span><span style="color: #007700">(</span><span style="color: #DD0000">'counter'</span><span style="color: #007700">, </span><span style="color: #0000BB">2923</span><span style="color: #007700">, </span><span style="color: #0000BB">$success</span><span style="color: #007700">));<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 /></span><span style="color: #0000BB">?></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> int(2922) bool(true) </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.wincache-ucache-dec-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.wincache-ucache-inc.html" class="function" rel="rdfs-seeAlso">wincache_ucache_inc()</a> - Increments the value associated with the key</span></li> <li class="member"> <span class="function"><a href="function.wincache-ucache-cas.html" class="function" rel="rdfs-seeAlso">wincache_ucache_cas()</a> - Compares the variable with old value and assigns new value to it</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.wincache-ucache-clear.html">wincache_ucache_clear</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.wincache-ucache-delete.html">wincache_ucache_delete</a></div> <div class="up"><a href="ref.wincache.html">WinCache Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>