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) { 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/7PI2L
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'
   18     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 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/7PI2L
function name:  trad
number of ops:  14
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        FETCH_DIM_R                                      ~1      !0, 1
          2        IS_EQUAL                                         ~2      ~1, ''
          3      > JMPNZ_EX                                         ~2      ~2, ->7
          4    >   FETCH_DIM_R                                      ~3      !0, 1
          5        IS_EQUAL                                         ~4      ~3, 'abc'
          6        BOOL                                             ~2      ~4
          7    > > JMPZ                                                     ~2, ->11
   13     8    >   FETCH_DIM_R                                      ~5      !0, 1
          9        CONCAT                                           ~6      ~5, '_es'
         10      > RETURN                                                   ~6
   14    11    >   FETCH_DIM_R                                      ~7      !0, 1
         12      > RETURN                                                   ~7
   15    13*     > RETURN                                                   null

End of function trad

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.53 ms | 1400 KiB | 15 Q