3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = 'echo "hello, my name is $array[foo] and it\'s nice to meet you";'; echo preg_replace_callback('/\".*(\$.*\[[^\'].*[^\']\]).*\"/', function($match) { $search = ['[', ']']; $replace = ["['", "']"]; $array = '" . ' . str_replace($search, $replace, $match[1]) . ' . "'; return str_replace($match[1], $array, $match[0]); }, $str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2cCvC
function name:  (null)
number of ops:  9
compiled vars:  !0 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'echo+%22hello%2C+my+name+is+%24array%5Bfoo%5D+and+it%27s+nice+to+meet+you%22%3B'
    4     1        INIT_FCALL                                                   'preg_replace_callback'
          2        SEND_VAL                                                     '%2F%5C%22.%2A%28%5C%24.%2A%5C%5B%5B%5E%27%5D.%2A%5B%5E%27%5D%5C%5D%29.%2A%5C%22%2F'
          3        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
   10     4        SEND_VAL                                                     ~2
          5        SEND_VAR                                                     !0
    4     6        DO_ICALL                                             $3      
   10     7        ECHO                                                         $3
          8      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2cCvC
function name:  {closure:/in/2cCvC:4}
number of ops:  15
compiled vars:  !0 = $match, !1 = $search, !2 = $replace, !3 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
    5     1        ASSIGN                                                       !1, <array>
    6     2        ASSIGN                                                       !2, <array>
    7     3        FETCH_DIM_R                                          ~6      !0, 1
          4        FRAMELESS_ICALL_3                str_replace         ~7      !1, !2
          5        OP_DATA                                                      ~6
          6        CONCAT                                               ~8      '%22+.+', ~7
          7        CONCAT                                               ~9      ~8, '+.+%22'
          8        ASSIGN                                                       !3, ~9
    9     9        FETCH_DIM_R                                          ~11     !0, 1
         10        FETCH_DIM_R                                          ~12     !0, 0
         11        FRAMELESS_ICALL_3                str_replace         ~13     ~11, !3
         12        OP_DATA                                                      ~12
         13      > RETURN                                                       ~13
   10    14*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.27 ms | 2045 KiB | 14 Q