Hi, had the same problem before and got around this by writing my own tiny parser that should work just nicely ( as serializing is a pain-in-the-ass when editing the .ini file on foot )
Anyway i switched to using an XML-File now :-) define ('REGEXP_VARIABLE','[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'); define ('REGEXP_INDEX','[0-9a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'); /** * @author Christian Jerono <[EMAIL PROTECTED]> * @param string $file_name Zu verarbeitende .INI-Datei * @param bool $process_sections Verarbeitung von Sectionen * @return array */ function _parse_config_file( $file_name , $process_sections = FALSE ){ $match_index = "#^\[?(". REGEXP_INDEX .")\]?#"; $match_section = "#^\s*\[(". REGEXP_VARIABLE .")\]#"; $match_config_param = "#^\s*(". REGEXP_VARIABLE ."(\[". REGEXP_INDEX ."\])*)\s*=\s*(.*)$#"; $match_value = "#^(([\\\"'])(.*)(?(2)[\\\"']))|([^;]*).*$#"; $return = array(); $file_content = file($file_name); $pointer =& $return; foreach ( $file_content AS $file_line ){ $file_line = trim($file_line); if ( $process_sections === TRUE AND preg_match( $match_section , $file_line , $section ) ){ $pointer =& $return[$section[1]]; } else if ( preg_match( $match_config_param , $file_line , $config_param ) ) { $index_name = $config_param[1]; $value = trim(preg_replace( $match_value , "\\3\\4" , $config_param[3] )); $sub_pointer =& $pointer; while ( preg_match( $match_index , $index_name , $temp ) ){ $sub_pointer =& $sub_pointer[$temp[1]]; $index_name = substr($index_name,strlen($temp[0])); } $sub_pointer = defined($value) ? constant($value) : $value; } } return $return; } -- red [...] > I have an ini file for my application and I use parse_ini_file to load it > and some custom code to save modifications. I'd like to figure out how > to store array values in there since that is the logical place to keep > config data. If I can't, I could probably use a string with @@ or | in > it as the token but an array is so much more elegant because that's what > it's meant to do :-) > > Any suggestions? [...] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php