PHP 8.4.2 Released!

dba_nextkey

(PHP 4, PHP 5, PHP 7, PHP 8)

dba_nextkeyFetch next key

Açıklama

dba_nextkey(Dba\Connection $dba): string|false

dba_nextkey() returns the next key of the database and advances the internal key pointer.

Bağımsız Değişkenler

dba

A Dba\Connection instance, returned by dba_open() or dba_popen().

Dönen Değerler

Returns the key on success başarısızlık durumunda false döner.

Sürüm Bilgisi

Sürüm: Açıklama
8.4.0 The dba parameter expects a Dba\Connection instance now; previously, a valid dba resource was expected.

Ayrıca Bakınız

add a note

User Contributed Notes 1 note

up
0
phpnet at araxon dot sk
2 years ago
It should be noted that it is not always safe to iterate through the database while changing it at the same time. For example:

<?php
$db
=dba_open(...);

// remove all values shorter than 10 characters
for ($key=dba_firstkey($db); $key!==false; $key=dba_nextkey($db)) {
$s=dba_fetch($key, $db);
if (
strlen($s)<10) {
dba_delete($key, $db);
}
}
?>

The above example will work fine with db4 handler, but not with gdbm. It is handler specific.
To Top