3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = "define('DB_PASSWORD', 'un}C)y~&tSzb'); un}C)y~&tSzb"; $b = 'define("DB_PASSWORD", "un}C)y~&tSzb"); un}C)y~&tSzb'; $c = 'DEFINE("DB_PASSWORD", "un}C)y~&tSzb"); un}C)y~&tSzb'; $d = "DEFINE('DB_PASSWORD', 'un}C)y~&tSzb'); un}C)y~&tSzb"; $old = preg_quote("un}C)y~&tSzb"); echo preg_replace('/define\([\'\"]db_password[\'\"],\s*[\'\"]'.$old.'[\'\"]/i', 'define("DB_PASSWORD", "123456")', $a) . "\n"; echo preg_replace('/define\([\'\"]db_password[\'\"],\s*[\'\"]'.$old.'[\'\"]/i', 'define("DB_PASSWORD", "123456")', $b) . "\n"; echo preg_replace('/define\([\'\"]db_password[\'\"],\s*[\'\"]'.$old.'[\'\"]/i', 'define("DB_PASSWORD", "123456")', $c) . "\n"; echo preg_replace('/define\([\'\"]db_password[\'\"],\s*[\'\"]'.$old.'[\'\"]/i', 'define("DB_PASSWORD", "123456")', $d) . "\n";
based on R8jkA
Output for 4.3.0 - 7.2.0
define("DB_PASSWORD", "123456")); un}C)y~&tSzb define("DB_PASSWORD", "123456")); un}C)y~&tSzb define("DB_PASSWORD", "123456")); un}C)y~&tSzb define("DB_PASSWORD", "123456")); un}C)y~&tSzb