3v4l.org

run code in 300+ PHP versions simultaneously
<?php $operations = [ '+' => "add", '-' => "subtract" ]; // The numbers $n1 = 6; $n2 = 3; // Your operation $op = "+"; switch($operations[$op]) { case "add": // add the nos echo $n1 + $n2; break; case "subtract": // subtract the nos echo $n1 - $n2; break; default: // we can't handle other operators throw new RuntimeException(); break; }
Finding entry points
Branch analysis from position: 0
4 jumps found. (Code = 188) Position 1 = 11, Position 2 = 14, Position 3 = 17, Position 4 = 6
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 17
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 14
Branch analysis from position: 11
filename:       /in/qaSDY
function name:  (null)
number of ops:  23
compiled vars:  !0 = $operations, !1 = $n1, !2 = $n2, !3 = $op
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, 6
   10     2        ASSIGN                                                   !2, 3
   12     3        ASSIGN                                                   !3, '%2B'
   14     4        FETCH_DIM_R                                      ~8      !0, !3
          5      > SWITCH_STRING                                            ~8, [ 'add':->11, 'subtract':->14, ], ->17
   15     6    >   CASE                                                     ~8, 'add'
          7      > JMPNZ                                                    ~9, ->11
   19     8    >   CASE                                                     ~8, 'subtract'
          9      > JMPNZ                                                    ~9, ->14
         10    > > JMP                                                      ->17
   17    11    >   ADD                                              ~10     !1, !2
         12        ECHO                                                     ~10
   18    13      > JMP                                                      ->21
   21    14    >   SUB                                              ~11     !1, !2
         15        ECHO                                                     ~11
   22    16      > JMP                                                      ->21
   25    17    >   NEW                                              $12     'RuntimeException'
         18        DO_FCALL                                      0          
         19      > THROW                                         0          $12
   26    20*       JMP                                                      ->21
         21    >   FREE                                                     ~8
   27    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.28 ms | 1399 KiB | 13 Q