(PHP 4, PHP 5, PHP 7, PHP 8)
dba_nextkey — 次のキーを取得する
dba_nextkey() は、 が指すデータベースの次のキーを返し、内部キーポインタを進めます。
成功した場合にキー、失敗した場合に false を返します。
| バージョン | 説明 |
|---|---|
| 8.4.0 |
dba は Dba\Connection クラスのインスタンスを期待するようになりました。
これより前のバージョンでは、 dba resource を期待していました。
|
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.