QuickHashStringIntHash::set

(No version information available, might only be in Git)

QuickHashStringIntHash::setThis method updates an entry in the hash with a new value, or adds a new one if the entry doesn't exist

Beschreibung

public QuickHashStringIntHash::set(string $key, int $value): int

This method tries to update an entry with a new value. In case the entry did not yet exist, it will instead add a new entry. It returns whether the entry was added or update. If there are duplicate keys, only the first found element will get an updated value. Use QuickHashStringIntHash::CHECK_FOR_DUPES during hash creation to prevent duplicate keys from being part of the hash.

Parameter-Liste

key

The key of the entry to add or update.

value

The value of the entry to add. If a non-string is passed, it will be converted to a string automatically if possible.

Rückgabewerte

2 if the entry was found and updated, 1 if the entry was newly added or 0 if there was an error.

Beispiele

Beispiel #1 QuickHashStringIntHash::set() example

<?php
$hash 
= new QuickHashStringIntHash1024 );

echo 
"Set->Add\n";
var_dump$hash->get"forty six thousand six hundred ninety two" ) );
var_dump$hash->set"forty six thousand six hundred ninety two"16091 ) );
var_dump$hash->get"forty six thousand six hundred ninety two" ) );

echo 
"Set->Update\n";
var_dump$hash->set"forty six thousand six hundred ninety two"29906 ) );
var_dump$hash->get"forty six thousand six hundred ninety two" ) );
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

Set->Add
bool(false)
int(2)
int(16091)
Set->Update
int(1)
int(29906)

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Grundlagen von Views in MySQL

Views in einer MySQL-Datenbank bieten die Möglichkeit, eine virtuelle Tabelle basierend auf dem Ergebnis einer SQL-Abfrage zu erstellen. ...

admin

Autor : admin
Kategorie: mySQL-Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Daten einer Abfrage mit Hilfe von Thumbnails nebeneinander ausgeben

Warum soll ich float meiden? Siehe https://www.linkedin.com/pulse/css-float-vs-grid-flexbox-sachin-tiwari Falls es mit Englisch nicht so klappt: ...

Geschrieben von scatello am 18.05.2024 05:57:56
Forum: PHP Developer Forum
Daten einer Abfrage mit Hilfe von Thumbnails nebeneinander ausgeben

Also den Fehler habe ich gefunden und abgestellt. Warum soll ich float meiden?

Geschrieben von Malchor am 17.05.2024 20:54:01
Forum: PHP Developer Forum
Daten einer Abfrage mit Hilfe von Thumbnails nebeneinander ausgeben

Dein HTML-Code ist definitiv kaputt und float solltest du auch vergessen. Beschäftige dich mit Flex-Box oder Grid

Geschrieben von scatello am 17.05.2024 20:43:50
Forum: PHP Developer Forum
Daten einer Abfrage mit Hilfe von Thumbnails nebeneinander ausgeben

Da ich viele unterschiedliche Tabellen benötige mache ich das so umständlich. Aber ist das der Grund warum das Floaten nicht funktioniert?

Geschrieben von Malchor am 17.05.2024 17:15:03
Forum: PHP Developer Forum