SyncSharedMemory::read

(PECL sync >= 1.1.0)

SyncSharedMemory::readCopy data from named shared memory

Beschreibung

public SyncSharedMemory::read(int $start = 0, int $length = ?)

Copies data from named shared memory.

Parameter-Liste

start

The start/offset, in bytes, to begin reading.

Hinweis:

If the value is negative, the starting position will begin at the specified number of bytes from the end of the shared memory segment.

length

The number of bytes to read.

Hinweis:

If unspecified, reading will stop at the end of the shared memory segment.

If the value is negative, reading will stop the specified number of bytes from the end of the shared memory segment.

Rückgabewerte

A string containing the data read from shared memory.

Beispiele

Beispiel #1 SyncSharedMemory::__construct() example

<?php
// You will probably need to protect shared memory with other synchronization objects.
// Shared memory goes away when the last reference to it disappears.
$mem = new SyncSharedMemory("AppReportName"1024);
if (
$mem->first())
{
    
// Do first time initialization work here.
}

$result $mem->write("report.txt");

$result $mem->read(3, -4);
var_dump($result);
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

string(3) "ort"

Siehe auch

Hier Kannst Du einen Kommentar verfassen


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

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

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

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

Kontakt über API anlegen per PHP

Hi! Zwei Hauptprobleme sehe ich: JSON falsch: Du benutzt => statt korrektes JSON. Besser so:​$data = json_encode([ "firstName" => $firstname, "l ...

Geschrieben von taboowooded am 03.11.2025 11:25:38
Forum: PHP Developer Forum
INPUT_GET nur bestimmte Einträge aussuchen

Du kannst $_GET filtern, um alle btnradioXXX-Variablen zu sammeln: ​$radioVars = []; foreach ($_GET as $key => $value) { if (strpos($key, 'btnra ...

Geschrieben von taboowooded am 03.11.2025 11:24:18
Forum: PHP Developer Forum
Suche nach Best Practices zur Leistungsoptimierung von PHP-Skripten!!

timothyeithan Du wolltest doch nur deinen Spamlink unterbringen! Verzieh dich!:mad:​

Geschrieben von scatello am 03.11.2025 11:02:38
Forum: PHP Developer Forum
Kalenderwoche auf Sonntag anfangen lassen

andrekyler Du wolltest doch nur deinen Spamlink unterbringen! Verzieh dich!:mad:

Geschrieben von scatello am 03.11.2025 11:00:33
Forum: PHP Developer Forum