Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* duct_tape anyone ?*/
- function parse_ini_file_fix($file) {
- $fh = fopen($file, 'r');
- $returnArray = array();
- while(false !== ($line = fgets($fh))) {
- if(preg_match("/[^;]+=.+/", $line)) {
- if(!preg_match('/\[.*\]/', $line)) {
- $exploded = explode('=', $line);
- $key = trim($exploded[0]);
- $value = trim(trim($exploded[1], '"'));
- $returnArray[$key] = $value;
- } else {
- preg_match('/(.*)\[(.*)\] = (.*)/', $line, $matches);
- if(!empty($matches)) {
- $returnArray[$matches[1]][$matches[2]] = $matches[3];
- }
- }
- }
- }
- return $returnArray;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement