downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

apc_define_constants> <apc_compile_file
[edit] Last updated: Fri, 25 May 2012

view this page in

apc_dec

(PECL apc >= 3.1.1)

apc_dec保存した数値を減らす

説明

int apc_dec ( string $key [, int $step = 1 [, bool &$success ]] )

保存した整数値を減らします。

パラメータ

key

減らしたい値のキー。

step

減らしたい数。

success

この参照渡しの変数に、成功したか失敗したかの結果が格納されます。

返り値

成功した場合に key の現在値を返します。 失敗した場合に FALSE を返します

例1 apc_dec() の例

<?php
echo "Let's do something with success"PHP_EOL;

apc_store('anumber'42);

echo 
apc_fetch('anumber'), PHP_EOL;

echo 
apc_dec('anumber'), PHP_EOL;
echo 
apc_dec('anumber'10), PHP_EOL;
echo 
apc_dec('anumber'10$success), PHP_EOL;

var_dump($success);

echo 
"Now, let's fail"PHP_EOLPHP_EOL;

apc_store('astring''foo');

$ret apc_dec('astring'1$fail);

var_dump($ret);
var_dump($fail);
?>

上の例の出力は、 たとえば以下のようになります。

Let's do something with success
42
41
31
21
bool(true)

Now, let's fail
bool(false)
bool(false)

参考



add a note add a note User Contributed Notes apc_dec
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites