3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = ['My Name ## is "#P_NAM3#" and \r\n', 'I am \'#P_AG2#\' years old `#abc#`']; //$r = '#(?P<name>.*?)#'; //$r = '#(\w*)#'; function trad($v) { var_dump($v); if($v[1] == '' || $v[1] == 'abc') return $v[1] . '_es'; return $v[1]; } echo preg_replace_callback('/#([^#]*)#/m', 'trad', $text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VD1XP
function name:  (null)
number of ops:  8
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%23%28%5B%5E%23%5D%2A%29%23%2Fm'
          3        SEND_VAL                                                 'trad'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ECHO                                                     $2
          7      > RETURN                                                   1

Function trad:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/VD1XP
function name:  trad
number of ops:  17
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   10     4        FETCH_DIM_R                                      ~2      !0, 1
          5        IS_EQUAL                                         ~3      ~2, ''
          6      > JMPNZ_EX                                         ~3      ~3, ->10
          7    >   FETCH_DIM_R                                      ~4      !0, 1
          8        IS_EQUAL                                         ~5      ~4, 'abc'
          9        BOOL                                             ~3      ~5
         10    > > JMPZ                                                     ~3, ->14
   11    11    >   FETCH_DIM_R                                      ~6      !0, 1
         12        CONCAT                                           ~7      ~6, '_es'
         13      > RETURN                                                   ~7
   12    14    >   FETCH_DIM_R                                      ~8      !0, 1
         15      > RETURN                                                   ~8
   13    16*     > RETURN                                                   null

End of function trad

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.41 ms | 1396 KiB | 17 Q