3v4l.org

run code in 500+ 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 = 31
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 31
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/5iXBD
function name:  (null)
number of ops:  33
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, ->31
          6    > > FE_FETCH_R                                                   $4, !0, ->31
    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                                                   'array_merge'
         19        FETCH_DIM_R                                          ~9      !1, 'valid'
         20        SEND_VAL                                                     ~9
         21        INIT_FCALL                                                   'array_reverse'
         22        FETCH_DIM_R                                          ~10     !1, 'move'
         23        SEND_VAL                                                     ~10
         24        DO_ICALL                                             $11     
         25        SEND_VAR                                                     $11
         26        DO_ICALL                                             $12     
         27        FRAMELESS_ICALL_2                implode             ~13     '+', $12
         28        CONCAT                                               ~14     ~13, '%0A'
         29        ECHO                                                         ~14
    7    30      > JMP                                                          ->6
         31    >   FE_FREE                                                      $4
   13    32      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5iXBD
function name:  {closure:/in/5iXBD:8}
number of ops:  16
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        FRAMELESS_ICALL_2                preg_match          ~2      '%2F%7B%28%3F%2119%7C20%29%5Cd%2B%7D%2F', !1
          3      > JMPZ                                                         ~2, ->9
          4    >   FETCH_DIM_W                                          $3      !0, 'move'
          5        ASSIGN_DIM                                           ~4      $3
          6        OP_DATA                                                      !1
          7        QM_ASSIGN                                            ~5      ~4
          8      > JMP                                                          ->13
          9    >   FETCH_DIM_W                                          $6      !0, 'valid'
         10        ASSIGN_DIM                                           ~7      $6
         11        OP_DATA                                                      !1
         12        QM_ASSIGN                                            ~5      ~7
         13    >   FREE                                                         ~5
   10    14      > RETURN                                                       !0
   11    15*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.04 ms | 1882 KiB | 17 Q