3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = "define('DB_PASSWORD', 'fuuu'); fuuu"; $b = 'define("DB_PASSWORD", "fuuu"); fuuu'; $c = 'DEFINE("DB_PASSWORD", "fuuu"); fuuu'; $d = "DEFINE('DB_PASSWORD', 'fuuu'); fuuu"; $new = "un}C)y~&tSzb"; echo preg_replace('/define\([\'\"]db_password[\'\"],\s*[\'\"]'.$new.'[\'\"]/i', 'define("DB_PASSWORD", "123456")', $a) . "\n"; echo preg_replace('/define\([\'\"]db_password[\'\"],\s*[\'\"]fuuu[\'\"]/i', 'define("DB_PASSWORD", "123456")', $b) . "\n"; echo preg_replace('/define\([\'\"]db_password[\'\"],\s*[\'\"]fuuu[\'\"]/i', 'define("DB_PASSWORD", "123456")', $c) . "\n"; echo preg_replace('/define\([\'\"]db_password[\'\"],\s*[\'\"]fuuu[\'\"]/i', 'define("DB_PASSWORD", "123456")', $d) . "\n";
based on tukJc
Output for 4.3.11 - 7.2.0
Warning: preg_replace(): Compilation failed: unmatched parentheses at offset 42 in /in/YebU2 on line 8 define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu
Output for 4.3.0 - 4.3.10
Warning: Compilation failed: unmatched parentheses at offset 42 in /in/YebU2 on line 8 define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu