xref: /PHP-7.0/ext/spl/examples/dba_dump.php (revision 2e8b9c00)
1<?php
2
3/** @file   dba_dump.php
4 * @brief   Program DBA dump utility
5 * @ingroup Examples
6 * @author  Marcus Boerger
7 * @date    2003 - 2005
8 *
9 * Usage: php dba_dump.php \<file\> \<handler\> [\<regex\>]
10 *
11 * Show all groups in the ini file specified by \<file\>.
12 * The regular expression \<regex\> is used to filter the by setting name.
13 *
14 * Note: configure with --enable-dba
15 */
16
17if ($argc < 3) {
18	echo <<<EOF
19Usage: php ${_SERVER['PHP_SELF']} <file> <handler> [<regex>]
20
21Show all groups in the ini file specified by <file>.
22The regular expression <regex> is used to filter the by setting name.
23
24
25EOF;
26	exit(1);
27}
28
29if (!class_exists("DbaReader", false)) require_once("dbareader.inc");
30if (!class_exists("KeyFilter", false)) require_once("keyfilter.inc");
31
32$db = new DbaReader($argv[1], $argv[2]);
33
34if ($argc>3) {
35	$db = new KeyFilter($db, $argv[3]);
36}
37
38foreach($db as $key => $val) {
39	echo "'$key' => '$val'\n";
40}
41
42?>