PHP Doku:: Adds to a numeric key - tokyotyrant.add.html

Verlauf / Chronik / History: (11) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische Datenbankerweiterungentokyo_tyrantThe TokyoTyrant classTokyoTyrant::add

Ein Service von Reinhard Neidl - Webprogrammierung.

The TokyoTyrant class

<<The TokyoTyrant class

TokyoTyrant::connect>>

TokyoTyrant::add

(PECL tokyo_tyrant >= 0.1.0)

TokyoTyrant::addAdds to a numeric key

Beschreibung

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.

Parameter-Liste

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.

Rückgabewerte

Returns the new value on success

Beispiele

Beispiel #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);
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

6.5

Siehe auch


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)