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 '}': unset($words[$brace_level]); $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 = 44
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 6
Branch analysis from position: 47
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 = 27, Position 4 = 40, Position 5 = 8
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 6
Branch analysis from position: 47
Branch analysis from position: 6
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 6
Branch analysis from position: 47
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 = 27
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 27
Branch analysis from position: 23
Branch analysis from position: 15
filename:       /in/H2RBN
function name:  (null)
number of ops:  48
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                                                      ->44
   21     6    >   FETCH_DIM_R                                      ~10     !0, !4
          7      > SWITCH_STRING                                            ~10, [ '%7B':->15, '%7D':->23, '%3B':->27, ], ->40
   22     8    >   CASE                                                     ~10, '%7B'
          9      > JMPNZ                                                    ~11, ->15
   27    10    >   CASE                                                     ~10, '%7D'
         11      > JMPNZ                                                    ~11, ->23
   32    12    >   CASE                                                     ~10, '%3B'
         13      > JMPNZ                                                    ~11, ->27
         14    > > JMP                                                      ->40
   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                                                      ->42
   28    23    >   UNSET_DIM                                                !3, !2
   29    24        PRE_DEC                                                  !2
   30    25        UNSET_DIM                                                !3, !2
   31    26      > JMP                                                      ->42
   33    27    >   INIT_FCALL                                               'trim'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $18     
         30        ASSIGN_DIM                                               !3, !2
         31        OP_DATA                                                  $18
   34    32        ASSIGN                                                   !1, ''
   35    33        INIT_FCALL                                               'implode'
         34        SEND_VAL                                                 '+'
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                         $20     
         37        CONCAT                                           ~21     $20, '%0A'
         38        ECHO                                                     ~21
   36    39      > JMP                                                      ->42
   38    40    >   FETCH_DIM_R                                      ~22     !0, !4
         41        ASSIGN_OP                                     8          !1, ~22
         42    >   FREE                                                     ~10
   20    43        PRE_INC                                                  !4
         44    >   STRLEN                                           ~25     !0
         45        IS_SMALLER                                               !4, ~25
         46      > JMPNZ                                                    ~26, ->6
   40    47    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.14 ms | 1075 KiB | 15 Q