php-src/ext/spl/examples/ini_groups.php

41 lines
862 B
PHP
Raw Normal View History

2003-07-16 21:52:03 +00:00
<?php
/** @file ini_groups.php
* @brief Program List groups within an ini file
* @ingroup Examples
* @author Marcus Boerger
2005-02-08 19:10:06 +00:00
* @date 2003 - 2005
2003-07-16 21:52:03 +00:00
*
* Usage: php dba_dump.php \<file\> [\<regex\>]
2003-07-16 21:52:03 +00:00
*
* Show all groups in the ini file specified by \<file\>.
* The regular expression \<regex\> is used to filter the result.
2003-07-16 21:52:03 +00:00
*
* Note: configure with --enable-dba
*/
2003-12-04 19:39:46 +00:00
if ($argc < 2) {
echo <<<EOF
Usage: php dba_dump.php <file> [<regex>]
Show all groups in the ini file specified by <file>.
The regular expression <regex> is used to filter the result.
EOF;
exit(1);
}
if (!class_exists("KeyFilter", false)) require_once("keyfilter.inc");
if (!class_exists("IniGroups", false)) require_once("inigroups.inc");
2003-07-16 21:52:03 +00:00
2004-05-06 22:55:25 +00:00
$it = new IniGroups($argv[1]);
2003-07-16 21:52:03 +00:00
if ($argc>2) {
2004-05-06 22:55:25 +00:00
$it = new KeyFilter($it, $argv[2]);
2003-07-16 21:52:03 +00:00
}
2003-12-04 19:39:46 +00:00
2003-07-16 21:52:03 +00:00
foreach($it as $group) {
echo "$group\n";
}
?>