I'm extending an application that stores configuration data in a php file. The file looks like this:
defined('DB_NAME') or define('DB_NAME', '');
defined('DB_USERNAME') or define('DB_USERNAME', '');
defined('DB_PASSWORD') or define('DB_PASSWORD', '');
Say, I want to make the parameter DB_NAME configurable from within the php application itself, thus avoiding manual changes in config.php. I thought of reading the file, searching for the string 'DB_NAME', do some string manipulation, and write the content back. However, this does not seem very elegant. Is there any other way?