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

search for in the

TokyoTyrant::connect> <TokyoTyrant
[edit] Last updated: Fri, 23 Mar 2012

view this page in

TokyoTyrant::add

(PECL tokyo_tyrant >= 0.1.0)

TokyoTyrant::addAdds to a numeric key

Opis

public number TokyoTyrant::add ( string $key , number $increment [, int $type = 0 ] )

Adds to an int or double value. This increments the value by the given amount and returns the new value. If the key does not exist a new key is created with initial value of the increment parameter.

Parametry

key

The string key

increment

The amount to increment

type

TokyoTyrant::RDBREC_INT or TokyoTyrant::RDBREC_DBL constant. If this parameter is omitted the type is guessed from the increment parameters type.

Zwracane wartości

Returns the new value on success

Przykłady

Przykład #1 TokyoTyrant::add() example

<?php
$tt 
= new TokyoTyrant("localhost"TokyoTyrant::RDBDEF_PORT);
/* Adds integer 3 to key and creates a new key */
$tt->add("test"3);

/* String value is converted to double */
echo $tt->add("test""3.5"TokyoTyrant::RDBREC_DBL);
?>

Powyższy przykład wyświetli coś podobnego do:

6.5

Zobacz też:



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

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