php - Parse ini file with brackets -
i have .ini files contains brackets ( )
php.net recomend parse.ini file parse_ini_file() functio, let's code looks like:
$ini = parse_ini_file('files/models.ini');
then error looks like:
warning: syntax error, unexpected '(' in files/models.ini on line 4 in \index.php on line 48
this text line 4
00name1=100 08/82-11/90 (443/445) typový sešit [v] [27]
problem getting file outsite , can not change it,
from multiple sites notice words have special meaning in ini file "null" "true" "no" "yes" not kind of situation.
so guys can advise me doing wrong or if impossible there workaround?
you can use option ini_scanner_raw
:
$ini = parse_ini_file('files/models.ini', false, ini_scanner_raw);
from documentation:
if ini_scanner_raw supplied, option values not parsed.
result test:
$ php test.php array(1) { ["foo"]=> string(9) "foo (bar)" ["00name1"]=> string(49) "100 08/82-11/90 (443/445) typový sešit [v] [27]" }
Comments
Post a Comment