3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface KeyInterface { public function open(); } class MagnetKey implements KeyInterface { public function open() { print 'open by magnet key:'; $this->slide(); } private function slide() { print 'slide down.'; } } class TurnKey implements KeyInterface { public function open() { print 'open by turn key:'; $this->insert(); $this->turn(); } private function insert() { print 'insert key.'; } private function turn() { print 'turn key.'; } } class Key { public function open() { print 'open door:'; $this->insert(); $this->turn(); } private function insert() { print 'insert key.'; } private function turn() { print 'turn key.'; } } class MagnetKeOld extends Key { public function open() { print 'open by magnet key:'; $this->insert(); $this->slide(); } private function slide() { print 'slide key.'; } } $k = new TurnKey(); if ($k instanceof KeyInterface) { $k->open(); } else { print 'turn key has no open() interface'; } $mk = new MagnetKey(); $mk->open(); interface Testable { public function test(); } interface MyCountable { public function count(); } abstract class MyAbstract { public abstract function test(); } class MyClass implements Testable, MyCountable { public function test() { print 'this is test method'; } public function count() { print 'this is count method'; } } $o = new MyClass(); $o->test(); $o->count();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  (null)
number of ops:  25
compiled vars:  !0 = $k, !1 = $mk, !2 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_CLASS                                            'magnetkey'
   19     1        DECLARE_CLASS                                            'turnkey'
   66     2        NEW                                              $3      'TurnKey'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   67     5        INSTANCEOF                                               !0, 'KeyInterface'
          6      > JMPZ                                                     ~6, ->10
   68     7    >   INIT_METHOD_CALL                                         !0, 'open'
          8        DO_FCALL                                      0          
          9      > JMP                                                      ->11
   70    10    >   ECHO                                                     'turn+key+has+no+open%28%29+interface'
   73    11    >   NEW                                              $8      'MagnetKey'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !1, $8
   74    14        INIT_METHOD_CALL                                         !1, 'open'
         15        DO_FCALL                                      0          
   88    16        DECLARE_CLASS                                            'myclass'
   98    17        NEW                                              $12     'MyClass'
         18        DO_FCALL                                      0          
         19        ASSIGN                                                   !2, $12
   99    20        INIT_METHOD_CALL                                         !2, 'test'
         21        DO_FCALL                                      0          
  100    22        INIT_METHOD_CALL                                         !2, 'count'
         23        DO_FCALL                                      0          
         24      > RETURN                                                   1

Class KeyInterface:
Function open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  open
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   null

End of function open

End of class KeyInterface.

Class MagnetKey:
Function open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  open
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'open+by+magnet+key%3A'
   11     1        INIT_METHOD_CALL                                         'slide'
          2        DO_FCALL                                      0          
   12     3      > RETURN                                                   null

End of function open

Function slide:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  slide
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ECHO                                                     'slide+down.'
   16     1      > RETURN                                                   null

End of function slide

End of class MagnetKey.

Class TurnKey:
Function open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  open
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ECHO                                                     'open+by+turn+key%3A'
   23     1        INIT_METHOD_CALL                                         'insert'
          2        DO_FCALL                                      0          
   24     3        INIT_METHOD_CALL                                         'turn'
          4        DO_FCALL                                      0          
   25     5      > RETURN                                                   null

End of function open

Function insert:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  insert
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ECHO                                                     'insert+key.'
   29     1      > RETURN                                                   null

End of function insert

Function turn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  turn
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   ECHO                                                     'turn+key.'
   33     1      > RETURN                                                   null

End of function turn

End of class TurnKey.

Class Key:
Function open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  open
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   ECHO                                                     'open+door%3A'
   40     1        INIT_METHOD_CALL                                         'insert'
          2        DO_FCALL                                      0          
   41     3        INIT_METHOD_CALL                                         'turn'
          4        DO_FCALL                                      0          
   42     5      > RETURN                                                   null

End of function open

Function insert:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  insert
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   ECHO                                                     'insert+key.'
   46     1      > RETURN                                                   null

End of function insert

Function turn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  turn
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   ECHO                                                     'turn+key.'
   50     1      > RETURN                                                   null

End of function turn

End of class Key.

Class MagnetKeOld:
Function open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  open
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   ECHO                                                     'open+by+magnet+key%3A'
   56     1        INIT_METHOD_CALL                                         'insert'
          2        DO_FCALL                                      0          
   57     3        INIT_METHOD_CALL                                         'slide'
          4        DO_FCALL                                      0          
   58     5      > RETURN                                                   null

End of function open

Function slide:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  slide
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E >   ECHO                                                     'slide+key.'
   63     1      > RETURN                                                   null

End of function slide

Function insert:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  insert
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   ECHO                                                     'insert+key.'
   46     1      > RETURN                                                   null

End of function insert

Function turn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  turn
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   ECHO                                                     'turn+key.'
   50     1      > RETURN                                                   null

End of function turn

End of class MagnetKeOld.

Class Testable:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  test
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   77     0  E > > RETURN                                                   null

End of function test

End of class Testable.

Class MyCountable:
Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  count
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   81     0  E > > RETURN                                                   null

End of function count

End of class MyCountable.

Class MyAbstract:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  test
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   85     0  E > > RETURN                                                   null

End of function test

End of class MyAbstract.

Class MyClass:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  test
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   90     0  E >   ECHO                                                     'this+is+test+method'
   91     1      > RETURN                                                   null

End of function test

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBUWm
function name:  count
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   94     0  E >   ECHO                                                     'this+is+count+method'
   95     1      > RETURN                                                   null

End of function count

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.18 ms | 1407 KiB | 13 Q