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

search for in the

apc_load_constants> <apc_fetch
[edit] Last updated: Fri, 25 May 2012

view this page in

apc_inc

(PECL apc >= 3.1.1)

apc_incIncrémente un nombre stocké

Description

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

Incrémente un nombre stocké.

Liste de paramètres

key

La clé de la valeur à incrémenter.

step

Le pas, ou la valeur à incrémenter.

success

Booléen optionnel pass/fail (par référence).

Valeurs de retour

Retourne la valeur courante de key en cas de succès, ou FALSE si une erreur survient

Exemples

Exemple #1 Exemple apc_inc()

<?php
echo "Faisons les choses bien"PHP_EOL;

apc_store('anumber'42);

echo 
apc_fetch('anumber'), PHP_EOL;

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

var_dump($success);

echo 
"Maintenant, un échec"PHP_EOLPHP_EOL;

apc_store('astring''foo');

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

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

L'exemple ci-dessus va afficher quelque chose de similaire à :

Faisons les choses bien
42
43
53
63
bool(true)
Maintenant, un échec

bool(false)
bool(false)

Voir aussi



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

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