Since a ;
indicates a comment in an ini file, parse_ini_file()
will correctly throw away everything behind a (non quoted) ;
.
For me it looks like you are misusing the ini
format, thus if you want to obtain that information, you need to parse the file on your own, like this:
$config = array();
foreach(file('/path/to/conf.ini') as $line) {
if(preg_match('/^([^;]*?)=(.*)/', $line, $m)) {
$config[$m[1]] = $m[2];
}
}
var_dump($config);
If you only need the value of config
, you can use this:
preg_match('/^\s*config\s*=(.*)/', file_get_contents('config.ini'), $m);
echo $config = $m[1];