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

39 lines
763 B
PHP
Raw Normal View History

2003-07-16 21:52:03 +00:00
<?php
2003-12-04 19:39:46 +00:00
/** List groups within an ini file
2003-07-16 21:52:03 +00:00
*
2003-12-04 19:39:46 +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.
*
* Note: configure with --enable-dba
*
2004-05-06 22:55:25 +00:00
* (c) Marcus Boerger, 2003 - 2004
2003-07-16 21:52:03 +00:00
*/
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")) require_once("keyfilter.inc");
if (!class_exists("IniGroups")) 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";
}
?>