dba_nextkey
(PHP 4, PHP 5, PHP 7)
dba_nextkey — Fetch next key
Описание
string dba_nextkey
( resource
$handle
)dba_nextkey() returns the next key of the database and advances the internal key pointer.
Возвращаемые значения
Returns the key on success или FALSE
в случае возникновения ошибки.
Смотрите также
- dba_firstkey() - Fetch first key
- dba_key_split() - Splits a key in string representation into array representation
- Example 2 in the DBA examples
Коментарии
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.