Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

+Iterator example

  • Loading branch information...
commit bf4097075d76e007e9539e20b281b0183f7b4f60 1 parent 0b4e670
Patrick Engel authored
Showing with 35 additions and 0 deletions.
  1. +18 −0 README.asciidoc
  2. +17 −0 docs/examples
View
18 README.asciidoc
@@ -130,6 +130,24 @@ echo $config->get(null, 'public_key_file');
echo $config['private_key_file'];
----------
+.iterate (SPL Iterator) :
+----------
+$config = new Config_Lite($filename);
+
+foreach ($config as $section => $name) {
+ if (is_array($name)) {
+ $s.= sprintf("[%s]\n", $section);
+ foreach ($name as $key => $val) {
+ $s.= sprintf("\t%s = %s\n", $key, $val);
+ }
+ } else {
+ $s.= sprintf("%s=%s\n", $section, $name);
+ }
+}
+----------
+
+
+
=== Notes & Limitations
* Config_Lite is an OO frontend to `parse_ini_file' and writing ini files,
View
17 docs/examples
@@ -92,3 +92,20 @@ if (preg_match($regex, 'Hello "World"!')) {
printf("no match found. regex:%s", $regex);
}
----------
+
+
+.iterate (SPL Iterator) :
+----------
+$config = new Config_Lite($filename);
+
+foreach ($config as $section => $name) {
+ if (is_array($name)) {
+ $s.= sprintf("[%s]\n", $section);
+ foreach ($name as $key => $val) {
+ $s.= sprintf("\t%s = %s\n", $key, $val);
+ }
+ } else {
+ $s.= sprintf("%s=%s\n", $section, $name);
+ }
+}
+----------
Please sign in to comment.
Something went wrong with that request. Please try again.