PHP: Hypertext Preprocessor (original) (raw)

dba_nextkey

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

dba_nextkey — Fetch next key

Description

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

Return Values

Returns the key on success or [false](reserved.constants.php#constant.false) on failure.

Changelog

Version Description
8.4.0 The dba parameter expects a Dba\Connection instance now; previously, a valid dba resource was expected.

See Also

Found A Problem?

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:

key!==false;key!==false; key!==false;key=dba_nextkey($db)) { s=dbafetch(s=dba_fetch(s=dbafetch(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.`