3v4l.org

run code in 300+ PHP versions simultaneously
<?php function myfunc($iter, $item) { $item = str_replace($iter[0],$iter[1],$item); return $item; } $a = array([',',''],['\n',"\n"]); $str = '1,2,3\n,4,5,6,\n,7,8,9'; var_dump(array_reduce($a, "myfunc", $str));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eWkkE
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a, !1 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, '1%2C2%2C3%5Cn%2C4%2C5%2C6%2C%5Cn%2C7%2C8%2C9'
   12     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'array_reduce'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 'myfunc'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function myfunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eWkkE
function name:  myfunc
number of ops:  12
compiled vars:  !0 = $iter, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'str_replace'
          3        FETCH_DIM_R                                      ~2      !0, 0
          4        SEND_VAL                                                 ~2
          5        FETCH_DIM_R                                      ~3      !0, 1
          6        SEND_VAL                                                 ~3
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !1, $4
    6    10      > RETURN                                                   !1
    7    11*     > RETURN                                                   null

End of function myfunc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.82 ms | 1395 KiB | 19 Q