1<?php
2
3
4$ini_array = file('sample.ini',FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
5
6$temp = array();
7$header_found = false;
8foreach ($ini_array as $entry) {
9  //echo "$entry\n";
10  if(strpos($entry,'[') !== false){
11     $header = trim($entry,'[]');
12     $temp[$header] = array();
13     $header_found = true;
14     echo "header:$header found\n";
15     continue;
16  }
17  if($header_found) {
18     $temp[$header][] = trim($entry);
19  }
20}
21echo "\n";
22print_r($temp);
23echo "\n";
24?>