diff options
Diffstat (limited to 'ext/spl/examples/dba_dump.php')
-rwxr-xr-x | ext/spl/examples/dba_dump.php | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/ext/spl/examples/dba_dump.php b/ext/spl/examples/dba_dump.php deleted file mode 100755 index 0481d15a92..0000000000 --- a/ext/spl/examples/dba_dump.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -/* dba dump utility - * - * Usage php dba_dump <file> <handler> - * - * Note: configure with --enable-dba - * - * (c) Marcus Boerger - */ - -class dba_reader implements spl_sequence_assoc -{ - - private $db = NULL; - private $key = false; - private $val = false; - - function __construct($file, $handler) { - $this->db = dba_open($file, 'r', $handler); - } - - function __destruct() { - if ($this->db) { - dba_close($this->db); - } - } - - function rewind() { - if ($this->db) { - $this->key = dba_firstkey($this->db); - } - } - - function current() { - return $this->val; - } - - function next() { - if ($this->db) { - $this->key = dba_nextkey($this->db); - if ($this->key !== false) { - $this->val = dba_fetch($this->key, $this->db); - } - } - } - - function has_more() { - if ($this->db && $this->key !== false) { - return true; - } else { - return false; - } - } - - function key() { - return $this->key; - } -} - -$db = new dba_reader($argv[1], $argv[2]); -foreach($db as $key => $val) { - echo "'$key' => '$val'\n"; -} - -?>
\ No newline at end of file |