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}'; foreach (explode("\n", $str) as $str) { $result = array_reduce(explode(" ", $str), function($acc, $curr) { preg_match("/{(?!19|20)\d+}/", $curr) ? $acc['move'][] = $curr : $acc['valid'][] = $curr; return $acc; }, ['valid' => [], 'move' => []]); echo implode(" ", array_merge($result['valid'], array_reverse($result['move']))) . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 34
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 34
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/5iXBD
function name:  (null)
number of ops:  36
compiled vars:  !0 = $str, !1 = $result
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                                               'explode'
          2        SEND_VAL                                                 '%0A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5      > FE_RESET_R                                       $4      $3, ->34
          6    > > FE_FETCH_R                                               $4, !0, ->34
    8     7    >   INIT_FCALL                                               'array_reduce'
          8        INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '+'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $5      
         12        SEND_VAR                                                 $5
         13        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
   11    14        SEND_VAL                                                 ~6
         15        SEND_VAL                                                 <array>
    8    16        DO_ICALL                                         $7      
         17        ASSIGN                                                   !1, $7
   12    18        INIT_FCALL                                               'implode'
         19        SEND_VAL                                                 '+'
         20        INIT_FCALL                                               'array_merge'
         21        FETCH_DIM_R                                      ~9      !1, 'valid'
         22        SEND_VAL                                                 ~9
         23        INIT_FCALL                                               'array_reverse'
         24        FETCH_DIM_R                                      ~10     !1, 'move'
         25        SEND_VAL                                                 ~10
         26        DO_ICALL                                         $11     
         27        SEND_VAR                                                 $11
         28        DO_ICALL                                         $12     
         29        SEND_VAR                                                 $12
         30        DO_ICALL                                         $13     
         31        CONCAT                                           ~14     $13, '%0A'
         32        ECHO                                                     ~14
    7    33      > JMP                                                      ->6
         34    >   FE_FREE                                                  $4
   13    35      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5iXBD
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $acc, !1 = $curr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%7B%28%3F%2119%7C20%29%5Cd%2B%7D%2F'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > JMPZ                                                     $2, ->12
          7    >   FETCH_DIM_W                                      $3      !0, 'move'
          8        ASSIGN_DIM                                       ~4      $3
          9        OP_DATA                                                  !1
         10        QM_ASSIGN                                        ~5      ~4
         11      > JMP                                                      ->16
         12    >   FETCH_DIM_W                                      $6      !0, 'valid'
         13        ASSIGN_DIM                                       ~7      $6
         14        OP_DATA                                                  !1
         15        QM_ASSIGN                                        ~5      ~7
         16    >   FREE                                                     ~5
   10    17      > RETURN                                                   !0
   11    18*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.5 ms | 1008 KiB | 19 Q