problem with parentheses in *.ini file

Discussion in 'PHP' started by B1gBear, Mar 2, 2010.

  1. #1
    Hi, I have a problem with parsing an .ini file. Everything is ok unless I use parentheses in .ini file, which I can parse.
    ini file
    sections = 1,2,3
    names = Name1,@Name2,@Name3
    Code (markup):
    With that code everything with parsing is ok, but
    sections = 1,2,3
    names = Name1,@Name2,@Name3 (this is temporary name)
    Code (markup):
    is not. I call
    parse_ini_file(myinifile.ini, true);
    PHP:
    and error is occured, when I run that script. I need to use parentheses too in my .ini file. Any ideas? Thnx
     
    B1gBear, Mar 2, 2010 IP
  2. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #2
    looks like you are out of luck :

    from the parse_ini_file function page. http://us.php.net/parse_ini_file course they don't outline what the special meaning is in the value.

    can you put quotes around the parens part?

    park = "I (walked) "
    names = Name1,@Name2,"@Name3 (this is temporary name)"
    this worked in a local test for me.
     
    shallowink, Mar 2, 2010 IP
  3. B1gBear

    B1gBear Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ok, thank you
     
    B1gBear, Mar 3, 2010 IP