I have an .ini files which contains brackets ( )
As php.net recomend I parse.ini file with parse_ini_file() functio, so let's say my 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 is text from line 4
00name1=100 08/82-11/90 (443/445) Typový sešit [V] [27]
Problem is I am getting this file from outsite and I can not change it,
From multiple sites I notice that some words have special meaning in ini file like "null" "true" "no" "yes" but this is not this kind of situation.
So guys can somebody advise me what I am doing wrong or if this is impossible is there any workaround?
You can use the option INI_SCANNER_RAW
:
$ini = parse_ini_file('files/models.ini', false, INI_SCANNER_RAW);
From the documentation:
If INI_SCANNER_RAW is supplied, then option values will not be parsed.
Result from my 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]"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With