I'm working on a function that reads a configuration file. First it reads the whole file and splits up every line into an array, then it reads every line for a configuration option and its respective value.
I.e. the configuration file could look like this:
Code: Select all
# Comment
cfg_option = 'value'Code: Select all
// Don't read commented or empty lines
if( substr( $line, 0, substr($string, 0, 1 - strlen( $string ) ) ) == '#' || empty( $line ) ) continue;
preg_match( '/(.*) = [\'|"](.*)[\'|"]/', $line, $values );Code: Select all
cfg_option= 'value'Any help would be great
thanks.