3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stored = "2+3*4/6"; $components = preg_split('~([*/+-])~', $stored, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); while (($index = array_search('*', $components)) !== false) { array_splice($components, $index - 1, 3, $components[$index - 1] * $components[$index + 1]); } while (($index = array_search('/', $components)) !== false) { array_splice($components, $index - 1, 3, $components[$index - 1] / $components[$index + 1]); } while (($index = array_search('+', $components)) !== false) { array_splice($components, $index - 1, 3, $components[$index - 1] + $components[$index + 1]); } while (($index = array_search('-', $components)) !== false) { array_splice($components, $index - 1, 3, $components[$index - 1] - $components[$index + 1]); } echo current($components);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 9
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 29
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 68, Position 2 = 49
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 81
Branch analysis from position: 81
2 jumps found. (Code = 44) Position 1 = 88, Position 2 = 69
Branch analysis from position: 88
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 69
2 jumps found. (Code = 44) Position 1 = 88, Position 2 = 69
Branch analysis from position: 88
Branch analysis from position: 69
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 68, Position 2 = 49
Branch analysis from position: 68
Branch analysis from position: 49
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 29
Branch analysis from position: 48
Branch analysis from position: 29
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 9
Branch analysis from position: 28
Branch analysis from position: 9
filename:       /in/d5RoU
function name:  (null)
number of ops:  93
compiled vars:  !0 = $stored, !1 = $components, !2 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2%2B3%2A4%2F6'
    4     1        INIT_FCALL                                               'preg_split'
          2        SEND_VAL                                                 '%7E%28%5B%2A%2F%2B-%5D%29%7E'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 3
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
    5     8      > JMP                                                      ->21
    6     9    >   INIT_FCALL                                               'array_splice'
         10        SEND_REF                                                 !1
         11        SUB                                              ~6      !2, 1
         12        SEND_VAL                                                 ~6
         13        SEND_VAL                                                 3
         14        SUB                                              ~7      !2, 1
         15        FETCH_DIM_R                                      ~8      !1, ~7
         16        ADD                                              ~9      !2, 1
         17        FETCH_DIM_R                                      ~10     !1, ~9
         18        MUL                                              ~11     ~8, ~10
         19        SEND_VAL                                                 ~11
         20        DO_ICALL                                                 
    5    21    >   INIT_FCALL                                               'array_search'
         22        SEND_VAL                                                 '%2A'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                         $13     
         25        ASSIGN                                           ~14     !2, $13
         26        TYPE_CHECK                                  1018          ~14
         27      > JMPNZ                                                    ~15, ->9
    8    28    > > JMP                                                      ->41
    9    29    >   INIT_FCALL                                               'array_splice'
         30        SEND_REF                                                 !1
         31        SUB                                              ~16     !2, 1
         32        SEND_VAL                                                 ~16
         33        SEND_VAL                                                 3
         34        SUB                                              ~17     !2, 1
         35        FETCH_DIM_R                                      ~18     !1, ~17
         36        ADD                                              ~19     !2, 1
         37        FETCH_DIM_R                                      ~20     !1, ~19
         38        DIV                                              ~21     ~18, ~20
         39        SEND_VAL                                                 ~21
         40        DO_ICALL                                                 
    8    41    >   INIT_FCALL                                               'array_search'
         42        SEND_VAL                                                 '%2F'
         43        SEND_VAR                                                 !1
         44        DO_ICALL                                         $23     
         45        ASSIGN                                           ~24     !2, $23
         46        TYPE_CHECK                                  1018          ~24
         47      > JMPNZ                                                    ~25, ->29
   11    48    > > JMP                                                      ->61
   12    49    >   INIT_FCALL                                               'array_splice'
         50        SEND_REF                                                 !1
         51        SUB                                              ~26     !2, 1
         52        SEND_VAL                                                 ~26
         53        SEND_VAL                                                 3
         54        SUB                                              ~27     !2, 1
         55        FETCH_DIM_R                                      ~28     !1, ~27
         56        ADD                                              ~29     !2, 1
         57        FETCH_DIM_R                                      ~30     !1, ~29
         58        ADD                                              ~31     ~28, ~30
         59        SEND_VAL                                                 ~31
         60        DO_ICALL                                                 
   11    61    >   INIT_FCALL                                               'array_search'
         62        SEND_VAL                                                 '%2B'
         63        SEND_VAR                                                 !1
         64        DO_ICALL                                         $33     
         65        ASSIGN                                           ~34     !2, $33
         66        TYPE_CHECK                                  1018          ~34
         67      > JMPNZ                                                    ~35, ->49
   14    68    > > JMP                                                      ->81
   15    69    >   INIT_FCALL                                               'array_splice'
         70        SEND_REF                                                 !1
         71        SUB                                              ~36     !2, 1
         72        SEND_VAL                                                 ~36
         73        SEND_VAL                                                 3
         74        SUB                                              ~37     !2, 1
         75        FETCH_DIM_R                                      ~38     !1, ~37
         76        ADD                                              ~39     !2, 1
         77        FETCH_DIM_R                                      ~40     !1, ~39
         78        SUB                                              ~41     ~38, ~40
         79        SEND_VAL                                                 ~41
         80        DO_ICALL                                                 
   14    81    >   INIT_FCALL                                               'array_search'
         82        SEND_VAL                                                 '-'
         83        SEND_VAR                                                 !1
         84        DO_ICALL                                         $43     
         85        ASSIGN                                           ~44     !2, $43
         86        TYPE_CHECK                                  1018          ~44
         87      > JMPNZ                                                    ~45, ->69
   17    88    >   INIT_FCALL                                               'current'
         89        SEND_VAR                                                 !1
         90        DO_ICALL                                         $46     
         91        ECHO                                                     $46
         92      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.3 ms | 1010 KiB | 17 Q