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 = '#([^#]*)#'; //$r = '#(?P<name>.*?)#'; //$r = '#(\w*)#'; //preg_match_all('/'.$r.'/m', $text, $m); //var_dump($m); function trad($v) { var_dump($v); if($v[1] == '' || $v[1] == 'abc') return $v[1] . '_es'; return $v[1]; } echo preg_replace_callback('/'.$r.'/m', 'trad', $text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CYnu5
function name:  (null)
number of ops:  11
compiled vars:  !0 = $text, !1 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'My+Name+%23%23+is+%22%23P_NAM3%23%22+and+%5Cr%5Cn+I+am+%27%23P_AG2%23%27+years+old+%60%23abc%23%60'
    4     1        ASSIGN                                                   !1, '%23%28%5B%5E%23%5D%2A%29%23'
   19     2        INIT_FCALL                                               'preg_replace_callback'
          3        CONCAT                                           ~4      '%2F', !1
          4        CONCAT                                           ~5      ~4, '%2Fm'
          5        SEND_VAL                                                 ~5
          6        SEND_VAL                                                 'trad'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $6      
          9        ECHO                                                     $6
         10      > 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/CYnu5
function name:  trad
number of ops:  17
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   13     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
   14    11    >   FETCH_DIM_R                                      ~6      !0, 1
         12        CONCAT                                           ~7      ~6, '_es'
         13      > RETURN                                                   ~7
   15    14    >   FETCH_DIM_R                                      ~8      !0, 1
         15      > RETURN                                                   ~8
   16    16*     > RETURN                                                   null

End of function trad

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.65 ms | 1396 KiB | 17 Q