3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "foo { bar tree; bar ball/sand; snafu { string; } random { nested { value; bohica; } } }"; $buf = ""; $brace_level = 0; $words = array(); for ($i = 0; $i < strlen($text); $i++) { switch ($text[$i]) { case '{': $words[$brace_level] = trim($buf); $buf = ""; $brace_level++; break; case '}': $brace_level--; unset($words[$brace_level]); break; case ';': $words[$brace_level] = trim($buf); $buf = ""; print implode(" ", $words)."\n"; break; default: $buf .= $text[$i]; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 6
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
5 jumps found. (Code = 188) Position 1 = 15, Position 2 = 23, Position 3 = 26, Position 4 = 39, Position 5 = 8
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 6
Branch analysis from position: 46
Branch analysis from position: 6
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 6
Branch analysis from position: 46
Branch analysis from position: 6
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 26
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 26
Branch analysis from position: 23
Branch analysis from position: 15
filename:       /in/cH7eh
function name:  (null)
number of ops:  47
compiled vars:  !0 = $text, !1 = $buf, !2 = $brace_level, !3 = $words, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'foo+%7B%0A++++bar+tree%3B%0A++++bar+ball%2Fsand%3B%0A++++snafu+%7B%0A++++++++string%3B%0A++++%7D%0A++++random+%7B%0A++++++++nested+%7B%0A++++++++++++value%3B%0A++++++++++++bohica%3B%0A++++++++%7D%0A++++%7D%0A%7D'
   17     1        ASSIGN                                                   !1, ''
   18     2        ASSIGN                                                   !2, 0
   19     3        ASSIGN                                                   !3, <array>
   20     4        ASSIGN                                                   !4, 0
          5      > JMP                                                      ->43
   21     6    >   FETCH_DIM_R                                      ~10     !0, !4
          7      > SWITCH_STRING                                            ~10, [ '%7B':->15, '%7D':->23, '%3B':->26, ], ->39
   22     8    >   CASE                                                     ~10, '%7B'
          9      > JMPNZ                                                    ~11, ->15
   27    10    >   CASE                                                     ~10, '%7D'
         11      > JMPNZ                                                    ~11, ->23
   31    12    >   CASE                                                     ~10, '%3B'
         13      > JMPNZ                                                    ~11, ->26
         14    > > JMP                                                      ->39
   23    15    >   INIT_FCALL                                               'trim'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $13     
         18        ASSIGN_DIM                                               !3, !2
         19        OP_DATA                                                  $13
   24    20        ASSIGN                                                   !1, ''
   25    21        PRE_INC                                                  !2
   26    22      > JMP                                                      ->41
   28    23    >   PRE_DEC                                                  !2
   29    24        UNSET_DIM                                                !3, !2
   30    25      > JMP                                                      ->41
   32    26    >   INIT_FCALL                                               'trim'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                         $18     
         29        ASSIGN_DIM                                               !3, !2
         30        OP_DATA                                                  $18
   33    31        ASSIGN                                                   !1, ''
   34    32        INIT_FCALL                                               'implode'
         33        SEND_VAL                                                 '+'
         34        SEND_VAR                                                 !3
         35        DO_ICALL                                         $20     
         36        CONCAT                                           ~21     $20, '%0A'
         37        ECHO                                                     ~21
   35    38      > JMP                                                      ->41
   37    39    >   FETCH_DIM_R                                      ~22     !0, !4
         40        ASSIGN_OP                                     8          !1, ~22
         41    >   FREE                                                     ~10
   20    42        PRE_INC                                                  !4
         43    >   STRLEN                                           ~25     !0
         44        IS_SMALLER                                               !4, ~25
         45      > JMPNZ                                                    ~26, ->6
   39    46    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.27 ms | 1400 KiB | 17 Q