denoteone Posted September 12, 2010 Share Posted September 12, 2010 I have been researching php.net regain the function parse_ini_file() I know you can pass it an actual ini file but what if you already saved the ini file as a string and saved the string in a variable can you pass that variable to the function? I am getting the following error [function.parse-ini-file]: failed to open stream: No such file or directory in this is how I am calling it. $settings = parse_ini_file($data); echo $settings["mac"]; Link to comment https://forums.phpfreaks.com/topic/213193-count-how-many-times-index-apears-in-array/ Share on other sites More sharing options...
objnoob Posted September 12, 2010 Share Posted September 12, 2010 array parse_ini_string ( string $ini [, bool $process_sections = false [, int $scanner_mode = INI_SCANNER_NORMAL ]] ) Link to comment https://forums.phpfreaks.com/topic/213193-count-how-many-times-index-apears-in-array/#findComment-1110126 Share on other sites More sharing options...
AbraCadaver Posted September 12, 2010 Share Posted September 12, 2010 If you have PHP 5.3 then use parse_ini_string(). If not, then you have to use the filename and pass it to parse_ini_file() because that's what it expects. Link to comment https://forums.phpfreaks.com/topic/213193-count-how-many-times-index-apears-in-array/#findComment-1110128 Share on other sites More sharing options...
objnoob Posted September 12, 2010 Share Posted September 12, 2010 Then why not build a file... use parse_ini_file, and delete the file Link to comment https://forums.phpfreaks.com/topic/213193-count-how-many-times-index-apears-in-array/#findComment-1110133 Share on other sites More sharing options...
AbraCadaver Posted September 12, 2010 Share Posted September 12, 2010 Then why not build a file... use parse_ini_file, and delete the file That's definitely a possibility. I almost posted that, but I was speaking to, in effect: "why doesn't passing a string of data to a function that expects a filename work..." Link to comment https://forums.phpfreaks.com/topic/213193-count-how-many-times-index-apears-in-array/#findComment-1110135 Share on other sites More sharing options...
denoteone Posted September 12, 2010 Author Share Posted September 12, 2010 Then why not build a file... use parse_ini_file, and delete the file this is what I am going to have to do. The info is actually in a database but saved in an ini format. I will get the info from the DB write it to a ini file then call the ini file so I can manipulate it. I can then resave the info in a variable and put it back in the DB. I am worried about the the new lines characters. Does this sound like the best way to accomplish this process? I am open to suggestions. Link to comment https://forums.phpfreaks.com/topic/213193-count-how-many-times-index-apears-in-array/#findComment-1110137 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.