3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '[prev title="sample1" cont="sample1a" res="sample1b" mw="1"][prev title="sample2" cont="sample2a" res="sample2b" mw="2"][prev title="sample3" cont="sample3a" res="sample3b" mw="3"]'; $arr = explode('][',$str); $expected = ''; foreach($arr as $row){ $res = explode(' ',trim($row,'[]')); $expected.= '['.$res[0].' '. $res[2].' '.$res[3].' '.$res[1].' '.$res[4].']'; } echo ($expected); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 35
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 35
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/FE8Xq
function name:  (null)
number of ops:  38
compiled vars:  !0 = $str, !1 = $arr, !2 = $expected, !3 = $row, !4 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5Bprev+title%3D%22sample1%22+cont%3D%22sample1a%22+res%3D%22sample1b%22+mw%3D%221%22%5D%5Bprev+title%3D%22sample2%22+cont%3D%22sample2a%22+res%3D%22sample2b%22+mw%3D%222%22%5D%5Bprev+title%3D%22sample3%22+cont%3D%22sample3a%22+res%3D%22sample3b%22+mw%3D%223%22%5D'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%5D%5B'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
    5     6        ASSIGN                                                   !2, ''
    6     7      > FE_RESET_R                                       $9      !1, ->35
          8    > > FE_FETCH_R                                               $9, !3, ->35
    7     9    >   INIT_FCALL                                               'explode'
         10        SEND_VAL                                                 '+'
         11        INIT_FCALL                                               'trim'
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 '%5B%5D'
         14        DO_ICALL                                         $10     
         15        SEND_VAR                                                 $10
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !4, $11
    8    18        FETCH_DIM_R                                      ~13     !4, 0
         19        CONCAT                                           ~14     '%5B', ~13
         20        CONCAT                                           ~15     ~14, '+'
         21        FETCH_DIM_R                                      ~16     !4, 2
         22        CONCAT                                           ~17     ~15, ~16
         23        CONCAT                                           ~18     ~17, '+'
         24        FETCH_DIM_R                                      ~19     !4, 3
         25        CONCAT                                           ~20     ~18, ~19
         26        CONCAT                                           ~21     ~20, '+'
         27        FETCH_DIM_R                                      ~22     !4, 1
         28        CONCAT                                           ~23     ~21, ~22
         29        CONCAT                                           ~24     ~23, '+'
         30        FETCH_DIM_R                                      ~25     !4, 4
         31        CONCAT                                           ~26     ~24, ~25
         32        CONCAT                                           ~27     ~26, '%5D'
         33        ASSIGN_OP                                     8          !2, ~27
    6    34      > JMP                                                      ->8
         35    >   FE_FREE                                                  $9
   10    36        ECHO                                                     !2
   13    37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.79 ms | 1016 KiB | 15 Q