3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = 1; switch(++$foo) { case ($foo == 1): echo "horse"; break; case ($foo == 2): echo "hammer"; break; default: echo "wat"; break; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
filename:       /in/d8m4O
function name:  (null)
number of ops:  17
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 1
    3     1        PRE_INC                                          ~2      !0
    4     2        IS_EQUAL                                         ~4      !0, 1
          3        CASE                                                     ~2, ~4
          4      > JMPNZ                                                    ~3, ->9
    7     5    >   IS_EQUAL                                         ~5      !0, 2
          6        CASE                                                     ~2, ~5
          7      > JMPNZ                                                    ~3, ->11
          8    > > JMP                                                      ->13
    5     9    >   ECHO                                                     'horse'
    6    10      > JMP                                                      ->15
    8    11    >   ECHO                                                     'hammer'
    9    12      > JMP                                                      ->15
   11    13    >   ECHO                                                     'wat'
   12    14      > JMP                                                      ->15
         15    >   FREE                                                     ~2
   14    16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.65 ms | 1385 KiB | 13 Q