3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = "This is a short sentence which should include all regex results"; echo preg_replace_callback( '~(\w{3})?(\w+)~', fn($m) => ($m[1] ? "+" : '') . "$m[0]*", $string );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JhA3O
function name:  (null)
number of ops:  9
compiled vars:  !0 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'This+is+a+short+sentence+which+should+include+all+regex+results'
    4     1        INIT_FCALL                                                   'preg_replace_callback'
    5     2        SEND_VAL                                                     '%7E%28%5Cw%7B3%7D%29%3F%28%5Cw%2B%29%7E'
    6     3        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
          4        SEND_VAL                                                     ~2
    7     5        SEND_VAR                                                     !0
    4     6        DO_ICALL                                             $3      
    7     7        ECHO                                                         $3
    8     8      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JhA3O
function name:  {closure:/in/JhA3O:6}
number of ops:  12
compiled vars:  !0 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
          1        FETCH_DIM_R                                          ~1      !0, 1
          2      > JMPZ                                                         ~1, ->5
          3    >   QM_ASSIGN                                            ~2      '%2B'
          4      > JMP                                                          ->6
          5    >   QM_ASSIGN                                            ~2      ''
          6    >   FETCH_DIM_R                                          ~3      !0, 0
          7        NOP                                                          
          8        FAST_CONCAT                                          ~4      ~3, '%2A'
          9        CONCAT                                               ~5      ~2, ~4
         10      > RETURN                                                       ~5
         11*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.1 ms | 1866 KiB | 14 Q