I want remove this line from my config file
line :define('APP_MAIL_FROM_EMAIL_NAME','example'); Here is my code
<?php $configFileContents = file_get_contents('config.php'); if (!empty($configFileContents)) { if (strstr($configFileContents, 'define(\'APP_MAIL_FROM_EMAIL_NAME\',')) { $configFileContents = preg_replace('/define\(\'APP_MAIL_FROM_EMAIL_NAME.*\R/', '', $configFileContents); } file_put_contents("config.php", $configFileContents); } ?> This code working fine but if that line like this
line :define('APP_MAIL_FROM_EMAIL_NAME' ,'example'); if space present between APP_MAIL_FROM_EMAIL_NAME' , and comma its not working what is the problem any changes needed what??
\Rfrom the regex, or make it optional