3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($input) { switch ($input) { case 'foo': echo "foo\n"; break; case 'bar': echo "bar\n"; break; default: echo "default\n"; break; case 'baz': echo "baz\n"; break; } } test('foo'); test('bar'); test('nope'); test('baz');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EtvW1
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_FCALL                                               'test'
          1        SEND_VAL                                                 'foo'
          2        DO_FCALL                                      0          
   27     3        INIT_FCALL                                               'test'
          4        SEND_VAL                                                 'bar'
          5        DO_FCALL                                      0          
   28     6        INIT_FCALL                                               'test'
          7        SEND_VAL                                                 'nope'
          8        DO_FCALL                                      0          
   29     9        INIT_FCALL                                               'test'
         10        SEND_VAL                                                 'baz'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
5 jumps found. (Code = 188) Position 1 = 9, Position 2 = 11, Position 3 = 15, Position 4 = 13, Position 5 = 2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 15
Branch analysis from position: 11
Branch analysis from position: 9
filename:       /in/EtvW1
function name:  test
number of ops:  18
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1      > SWITCH_STRING                                            !0, [ 'foo':->9, 'bar':->11, 'baz':->15, ], ->13
    7     2    >   IS_EQUAL                                                 !0, 'foo'
          3      > JMPNZ                                                    ~1, ->9
   11     4    >   IS_EQUAL                                                 !0, 'bar'
          5      > JMPNZ                                                    ~1, ->11
   19     6    >   IS_EQUAL                                                 !0, 'baz'
          7      > JMPNZ                                                    ~1, ->15
          8    > > JMP                                                      ->13
    8     9    >   ECHO                                                     'foo%0A'
    9    10      > JMP                                                      ->17
   12    11    >   ECHO                                                     'bar%0A'
   13    12      > JMP                                                      ->17
   16    13    >   ECHO                                                     'default%0A'
   17    14      > JMP                                                      ->17
   20    15    >   ECHO                                                     'baz%0A'
   21    16      > JMP                                                      ->17
   24    17    > > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.61 ms | 1403 KiB | 17 Q