3v4l.org

run code in 300+ PHP versions simultaneously
<?php function testSwitch($value) { switch($value) { case 'foo': return 'foo was given'; case 'bar': return 'bar was given'; default: return 'undefined value was given'; } } var_dump(testSwitch('foo')); var_dump(testSwitch('bar')); var_dump(testSwitch(''));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EEXg4
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'testswitch'
          2        SEND_VAL                                                 'foo'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   15     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'testswitch'
          8        SEND_VAL                                                 'bar'
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   16    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'testswitch'
         14        SEND_VAL                                                 ''
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function testswitch:
Finding entry points
Branch analysis from position: 0
4 jumps found. (Code = 188) Position 1 = 7, Position 2 = 8, Position 3 = 9, Position 4 = 2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 8
Branch analysis from position: 7
filename:       /in/EEXg4
function name:  testSwitch
number of ops:  11
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1      > SWITCH_STRING                                            !0, [ 'foo':->7, 'bar':->8, ], ->9
    5     2    >   IS_EQUAL                                                 !0, 'foo'
          3      > JMPNZ                                                    ~1, ->7
    7     4    >   IS_EQUAL                                                 !0, 'bar'
          5      > JMPNZ                                                    ~1, ->8
          6    > > JMP                                                      ->9
    6     7    > > RETURN                                                   'foo+was+given'
    8     8    > > RETURN                                                   'bar+was+given'
   10     9    > > RETURN                                                   'undefined+value+was+given'
   12    10*     > RETURN                                                   null

End of function testswitch

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.3 ms | 1399 KiB | 18 Q