php8.5
Home/ Manual/ sync / syncsharedmemory/ SyncSharedMemory::first

SyncSharedMemory::first

PHP function Edit on GitHub ✎

(PECL sync >= 1.1.0)

Check to see if the object is the first instance system-wide of named shared memory

Description

SyncSharedMemory::first(): bool

Retrieves the system-wide first instance status of a SyncSharedMemory object.

Parameters Parameters

Return Values

Success

Examples

SyncSharedMemory::first() example

php
<?php
$mem = new SyncSharedMemory("AppReportName", 1024);
if ($mem->first())
{
    // Do first time initialization work here.
}

var_dump($mem->first());

$mem2 = new SyncSharedMemory("AppReportName", 1024);

var_dump($mem2->first());
?>

The above example will output something similar to:

output
bool(true)
bool(false)

See Also

  • SyncSharedMemory::write
  • SyncSharedMemory::read

Source: reference/sync/syncsharedmemory/first.xml · from the official PHP manual (php/doc-en)