Join the forums now, and start posting to receive access to our Scripts Vault!
// usage: array = load_settings(filename)function load_settings($file) { // store the settings values $settings = array(); // split the file into lines $lines = file($file); // parse the file line by line foreach ($lines as $line) { // trim and get rid of comments $uncommented_line = explode("#", trim($line)); $line = $uncommented_line[0]; // split the line by '=' $line_data = explode("=", trim($line), 2); // translate line to settings if (count($line_data) == 2) { // clean up $line_data and store it $settings[trim($line_data[0])] = trim($line_data[1]); } } // return array of settings return $settings;}
# this is the test configEASY_SCRIPT = trueBEAM_RULES = true# i hope it worksSCRIPT_FAILS = false# comment testCOMMENTS = true # invisible comment