So I have a file for constants. I want to let user define them and then edit my .php filr with that global constants (not xml – real PHP file )
With such code for example
<?php
// Database Constants
define("DB_SERVER", "localhost");
define("DB_USER", "root");
define("DB_PASS", "000000");
define("DB_NAME", "cms");
?>
How to edit this .php file from another PHP file? Is it possible?
Btw in future I want to implement not only constants redefining but some smart code that will be able to modify itself.
If someone can, please show me a function to change word “localhost” in my file…
FILE_TO_REPLACE_IN.php:
SCRIPT_TO_CHANGE_WITH.php:
… or something like that.