Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005

    Reading config files

    A lot of scripts have config files similar to something like this

    variable = value #more comments
    anotherVariable = "another value" #comments continued

    Is there a way to read these files in php into php variables and values, other than walking through the file character by character with tons of if and for statements?

  2. #2
    Join Date
    Nov 2003
    If you use an ini file format for your configuration, there's parse_ini_file()
    I'm not aware of anything to read the specific format you posted but it doesn't look like it would be too difficult.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts