3v4l.org

run code in 300+ 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}
number of ops:  21
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        INIT_FCALL                                               'str_replace'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !2
          6        FETCH_DIM_R                                      ~6      !0, 1
          7        SEND_VAL                                                 ~6
          8        DO_ICALL                                         $7      
          9        CONCAT                                           ~8      '%22+.+', $7
         10        CONCAT                                           ~9      ~8, '+.+%22'
         11        ASSIGN                                                   !3, ~9
    9    12        INIT_FCALL                                               'str_replace'
         13        FETCH_DIM_R                                      ~11     !0, 1
         14        SEND_VAL                                                 ~11
         15        SEND_VAR                                                 !3
         16        FETCH_DIM_R                                      ~12     !0, 0
         17        SEND_VAL                                                 ~12
         18        DO_ICALL                                         $13     
         19      > RETURN                                                   $13
   10    20*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.51 ms | 1000 KiB | 15 Q