3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '# (811) (1485) [2756] {29} [555] {15} # (811) (1476) {20} {15} (1485) [196] [2441] # (911) (619) {19} (1476) [2765] [2752] {21}'; echo preg_replace_callback('~ {(?!(?:19|20)})(\d+)}(?! *$)| *$~m', function($m) { static $rep = ''; $rep .= $m[0]; if ( !isset($m[1]) && [$ret, $rep] = [$rep, ''] ) return $ret; }, $str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vA3D4
function name:  (null)
number of ops:  9
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%23+%28811%29+%281485%29+%5B2756%5D+%7B29%7D+%5B555%5D+%7B15%7D+%0A%23+%28811%29+%281476%29+%7B20%7D+%7B15%7D+%281485%29+%5B196%5D+%5B2441%5D+%0A%23+%28911%29+%28619%29+%7B19%7D+%281476%29+%5B2765%5D+%5B2752%5D+%7B21%7D'
    7     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%7E+%7B%28%3F%21%28%3F%3A19%7C20%29%7D%29%28%5Cd%2B%29%7D%28%3F%21+%2A%24%29%7C+%2A%24%7Em'
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   11     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
    7     6        DO_ICALL                                         $3      
   11     7        ECHO                                                     $3
          8      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/vA3D4
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $m, !1 = $rep, !2 = $ret
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        BIND_STATIC                                              !1
    9     2        FETCH_DIM_R                                      ~3      !0, 0
          3        ASSIGN_OP                                     8          !1, ~3
   10     4        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      !0, 1
          5        BOOL_NOT                                         ~6      ~5
          6      > JMPZ_EX                                          ~6      ~6, ->14
          7    >   INIT_ARRAY                                       ~7      !1
          8        ADD_ARRAY_ELEMENT                                ~7      ''
          9        FETCH_LIST_R                                     $8      ~7, 0
         10        ASSIGN                                                   !2, $8
         11        FETCH_LIST_R                                     $10     ~7, 1
         12        ASSIGN                                                   !1, $10
         13        BOOL                                             ~6      ~7
         14    > > JMPZ                                                     ~6, ->16
         15    > > RETURN                                                   !2
   11    16    > > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.89 ms | 998 KiB | 14 Q