3v4l.org

run code in 300+ PHP versions simultaneously
<?php class O { public $string = 'string'; public $int = 0; public $float = 1.0; function method($name) { return $this->$name; } } $o = new O; $switch = 'string'; switch ($switch) { case $o->string: case $o->int: case $o->float: echo "accept\n"; break; } switch ($switch) { case $o->method('string'): case $o->method('int'): case $o->method('float'): echo "accept\n"; break; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 32
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 32
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 32
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 32
Branch analysis from position: 32
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 14
Branch analysis from position: 14
filename:       /in/5RYZ2
function name:  (null)
number of ops:  35
compiled vars:  !0 = $o, !1 = $switch
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $2      'O'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   14     3        ASSIGN                                                   !1, 'string'
   16     4        FETCH_OBJ_R                                      ~7      !0, 'string'
          5        IS_EQUAL                                                 !1, ~7
          6      > JMPNZ                                                    ~6, ->14
   17     7    >   FETCH_OBJ_R                                      ~8      !0, 'int'
          8        IS_EQUAL                                                 !1, ~8
          9      > JMPNZ                                                    ~6, ->14
   18    10    >   FETCH_OBJ_R                                      ~9      !0, 'float'
         11        IS_EQUAL                                                 !1, ~9
         12      > JMPNZ                                                    ~6, ->14
         13    > > JMP                                                      ->16
   19    14    >   ECHO                                                     'accept%0A'
   20    15      > JMP                                                      ->16
   24    16    >   INIT_METHOD_CALL                                         !0, 'method'
         17        SEND_VAL_EX                                              'string'
         18        DO_FCALL                                      0  $11     
         19        IS_EQUAL                                                 !1, $11
         20      > JMPNZ                                                    ~10, ->32
   25    21    >   INIT_METHOD_CALL                                         !0, 'method'
         22        SEND_VAL_EX                                              'int'
         23        DO_FCALL                                      0  $12     
         24        IS_EQUAL                                                 !1, $12
         25      > JMPNZ                                                    ~10, ->32
   26    26    >   INIT_METHOD_CALL                                         !0, 'method'
         27        SEND_VAL_EX                                              'float'
         28        DO_FCALL                                      0  $13     
         29        IS_EQUAL                                                 !1, $13
         30      > JMPNZ                                                    ~10, ->32
         31    > > JMP                                                      ->34
   27    32    >   ECHO                                                     'accept%0A'
   28    33      > JMP                                                      ->34
   29    34    > > RETURN                                                   1

Class O:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5RYZ2
function name:  method
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        FETCH_OBJ_R                                      ~1      !0
          2      > RETURN                                                   ~1
    9     3*     > RETURN                                                   null

End of function method

End of class O.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.79 ms | 1399 KiB | 13 Q