3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Rtm = '@[ Test Career 12](career:235)@[ Testing11](business:2)@[ Username](user:1)some text'; $Rtm = preg_replace_callback('/@\[([^]]*)\]\(([a-z]+):([^)]*)\)/', function ($match) { switch($match[2]) { case 'user': return "<a href=\"/en/main/profile_page_link/$match[3]\">$match[1]</a>"; break; case 'business': return "<a href=\"/en/business/1/about\">$match[1]</a>"; break; case 'career': return "<a href=\"/en/main/2/about\">$match[1]</a>"; break; default: return ""; break; } }, $Rtm); echo $Rtm;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tKTMo
function name:  (null)
number of ops:  10
compiled vars:  !0 = $Rtm
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%40%5B+Test+Career+12%5D%28career%3A235%29%40%5B+Testing11%5D%28business%3A2%29%40%5B+Username%5D%28user%3A1%29some+text'
    5     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%40%5C%5B%28%5B%5E%5D%5D%2A%29%5C%5D%5C%28%28%5Ba-z%5D%2B%29%3A%28%5B%5E%29%5D%2A%29%5C%29%2F'
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   20     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
    5     6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !0, $3
   21     8        ECHO                                                     !0
   22     9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
5 jumps found. (Code = 188) Position 1 = 10, Position 2 = 20, Position 3 = 27, Position 4 = 34, Position 5 = 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 27
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 27
Branch analysis from position: 20
Branch analysis from position: 10
filename:       /in/tKTMo
function name:  {closure}
number of ops:  39
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        FETCH_DIM_R                                      ~1      !0, 2
          2      > SWITCH_STRING                                            ~1, [ 'user':->10, 'business':->20, 'career':->27, ], ->34
    7     3    >   CASE                                                     ~1, 'user'
          4      > JMPNZ                                                    ~2, ->10
   10     5    >   CASE                                                     ~1, 'business'
          6      > JMPNZ                                                    ~2, ->20
   13     7    >   CASE                                                     ~1, 'career'
          8      > JMPNZ                                                    ~2, ->27
          9    > > JMP                                                      ->34
    8    10    >   ROPE_INIT                                     5  ~6      '%3Ca+href%3D%22%2Fen%2Fmain%2Fprofile_page_link%2F'
         11        FETCH_DIM_R                                      ~3      !0, 3
         12        ROPE_ADD                                      1  ~6      ~6, ~3
         13        ROPE_ADD                                      2  ~6      ~6, '%22%3E'
         14        FETCH_DIM_R                                      ~4      !0, 1
         15        ROPE_ADD                                      3  ~6      ~6, ~4
         16        ROPE_END                                      4  ~5      ~6, '%3C%2Fa%3E'
         17        FREE                                                     ~1
         18      > RETURN                                                   ~5
    9    19*       JMP                                                      ->37
   11    20    >   ROPE_INIT                                     3  ~11     '%3Ca+href%3D%22%2Fen%2Fbusiness%2F1%2Fabout%22%3E'
         21        FETCH_DIM_R                                      ~9      !0, 1
         22        ROPE_ADD                                      1  ~11     ~11, ~9
         23        ROPE_END                                      2  ~10     ~11, '%3C%2Fa%3E'
         24        FREE                                                     ~1
         25      > RETURN                                                   ~10
   12    26*       JMP                                                      ->37
   14    27    >   ROPE_INIT                                     3  ~15     '%3Ca+href%3D%22%2Fen%2Fmain%2F2%2Fabout%22%3E'
         28        FETCH_DIM_R                                      ~13     !0, 1
         29        ROPE_ADD                                      1  ~15     ~15, ~13
         30        ROPE_END                                      2  ~14     ~15, '%3C%2Fa%3E'
         31        FREE                                                     ~1
         32      > RETURN                                                   ~14
   15    33*       JMP                                                      ->37
   17    34    >   FREE                                                     ~1
         35      > RETURN                                                   ''
   18    36*       JMP                                                      ->37
         37*       FREE                                                     ~1
   20    38*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.46 ms | 994 KiB | 14 Q