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
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6IR3u
function name:  (null)
number of ops:  39
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $d, !4 = $new
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, 'define%28%27DB_PASSWORD%27%2C+%27fuuu%27%29%3B+fuuu'
   4     1        ASSIGN                                                   !1, 'define%28%22DB_PASSWORD%22%2C+%22fuuu%22%29%3B+fuuu'
   5     2        ASSIGN                                                   !2, 'DEFINE%28%22DB_PASSWORD%22%2C+%22fuuu%22%29%3B+fuuu'
   6     3        ASSIGN                                                   !3, 'DEFINE%28%27DB_PASSWORD%27%2C+%27fuuu%27%29%3B+fuuu'
   7     4        INIT_FCALL                                               'preg_quote'
         5        SEND_VAL                                                 'un%7DC%29y%7E%26tSzb'
         6        DO_ICALL                                         $9      
         7        ASSIGN                                                   !4, $9
   8     8        INIT_FCALL                                               'preg_replace'
         9        CONCAT                                           ~11     '%2Fdefine%5C%28%5B%27%5C%22%5Ddb_password%5B%27%5C%22%5D%2C%5Cs%2A%5B%27%5C%22%5D', !4
        10        CONCAT                                           ~12     ~11, '%5B%27%5C%22%5D%2Fi'
        11        SEND_VAL                                                 ~12
        12        SEND_VAL                                                 'define%28%22DB_PASSWORD%22%2C+%22123456%22%29'
        13        SEND_VAR                                                 !0
        14        DO_ICALL                                         $13     
        15        CONCAT                                           ~14     $13, '%0A'
        16        ECHO                                                     ~14
   9    17        INIT_FCALL                                               'preg_replace'
        18        SEND_VAL                                                 '%2Fdefine%5C%28%5B%27%5C%22%5Ddb_password%5B%27%5C%22%5D%2C%5Cs%2A%5B%27%5C%22%5Dfuuu%5B%27%5C%22%5D%2Fi'
        19        SEND_VAL                                                 'define%28%22DB_PASSWORD%22%2C+%22123456%22%29'
        20        SEND_VAR                                                 !1
        21        DO_ICALL                                         $15     
        22        CONCAT                                           ~16     $15, '%0A'
        23        ECHO                                                     ~16
  10    24        INIT_FCALL                                               'preg_replace'
        25        SEND_VAL                                                 '%2Fdefine%5C%28%5B%27%5C%22%5Ddb_password%5B%27%5C%22%5D%2C%5Cs%2A%5B%27%5C%22%5Dfuuu%5B%27%5C%22%5D%2Fi'
        26        SEND_VAL                                                 'define%28%22DB_PASSWORD%22%2C+%22123456%22%29'
        27        SEND_VAR                                                 !2
        28        DO_ICALL                                         $17     
        29        CONCAT                                           ~18     $17, '%0A'
        30        ECHO                                                     ~18
  11    31        INIT_FCALL                                               'preg_replace'
        32        SEND_VAL                                                 '%2Fdefine%5C%28%5B%27%5C%22%5Ddb_password%5B%27%5C%22%5D%2C%5Cs%2A%5B%27%5C%22%5Dfuuu%5B%27%5C%22%5D%2Fi'
        33        SEND_VAL                                                 'define%28%22DB_PASSWORD%22%2C+%22123456%22%29'
        34        SEND_VAR                                                 !3
        35        DO_ICALL                                         $19     
        36        CONCAT                                           ~20     $19, '%0A'
        37        ECHO                                                     ~20
        38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0