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 = preg_quote("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 YebU2

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
define('DB_PASSWORD', 'fuuu'); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu
Output for Arrow functions
define('DB_PASSWORD', 'fuuu'); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu
Output for Object typehint
define('DB_PASSWORD', 'fuuu'); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu
Output for Array change keys
define('DB_PASSWORD', 'fuuu'); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu
Output for Lexical anon
define('DB_PASSWORD', 'fuuu'); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu define("DB_PASSWORD", "123456")); fuuu

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page