Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function parseIniFile($data_file) {
//Since the PHP version sucks
$on = false; //Represents writing the section information should be turned on
$rows = file($data_file);
$ini_parsed = array();
foreach ($rows as $row) {
$row = trim($row);
//Conditional skips comments (middle of line comments not supported)
if (substr($row, 0, 1) != "#") {
$pattern = "/\[([a-zA-Z0-9_ ]*)\]/";
$replacement = "\$1";
foreach($rows as $row) {
if (preg_match($pattern, $row)) {
$section_name = preg_replace($pattern, $replacement, $row);
$section_name = trim($section_name);
$ini_parsed[$section_name] = array(); //Do this explicity to catch empty sections
$on = false;
}
if ($on) {
$key_string = explode("=", $row);
//If there's no = sign it can't be a valid key
if ( count($key_string) > 1 ) {
$key_name = $key_string[0];
array_shift($key_string);
$key_value = implode("=", $key_string);
$ini_parsed[$section_name][$key_name] = trim($key_value);
}
} else {
$on = true;
}
}
}
}
return $ini_parsed;
}