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