static function ParseString($string, $variables = array()) { if (count($variables) > 0) { $keys = array_keys($variables); $values = array_values($variables); $string = str_replace($keys, $values, $string); } $aResult = array(); $a =& $aResult; $lines = explode("\n", $string); foreach ($lines as $line) { $line = trim($line); if (strlen($line) < 1) { continue; } if ($line[0] == ';') { continue; } //sections if ($line[0] == '[') { $line = gp_ini::GetQuotedText($line, ']'); if ($line == false) { return false; } $a =& $aResult[$line]; continue; } gp_ini::GetAssignment($line, $key, $value); if ($key !== false && $value !== false) { $a[$key] = $value; } } return $aResult; }
function ParseString($string) { $aResult = array(); $a =& $aResult; $lines = explode("\n", $string); foreach ($lines as $line) { $line = trim($line); if (strlen($line) < 1) { continue; } if ($line[0] == ';') { continue; } //sections if ($line[0] == '[') { $line = gp_ini::GetQuotedText($line, ']'); if ($line == false) { return false; } $a =& $aResult[$line]; continue; } gp_ini::GetAssignment($line, $key, $value); if ($key !== false && $value !== false) { $a[$key] = $value; } } return $aResult; }