3v4l.org

run code in 300+ PHP versions simultaneously
<?php class AbstractFoo { public static function instance() { return new static(); } public function publicMethod() { echo __METHOD__; } protected function protectedMethod() { echo __METHOD__; } } class Foo extends AbstractFoo { public function testProtected() { // it works Bar::instance()->protectedMethod(); } } class Bar extends AbstractFoo { } Foo::instance()->testProtected();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   INIT_STATIC_METHOD_CALL                                  'Foo', 'instance'
          1        DO_FCALL                                      0  $0      
          2        INIT_METHOD_CALL                                         $0, 'testProtected'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Class AbstractFoo:
Function instance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  instance
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
    8     3*     > RETURN                                                   null

End of function instance

Function publicmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  publicMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                     'AbstractFoo%3A%3ApublicMethod'
   13     1      > RETURN                                                   null

End of function publicmethod

Function protectedmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  protectedMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ECHO                                                     'AbstractFoo%3A%3AprotectedMethod'
   18     1      > RETURN                                                   null

End of function protectedmethod

End of class AbstractFoo.

Class Foo:
Function testprotected:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  testProtected
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_STATIC_METHOD_CALL                                  'Bar', 'instance'
          1        DO_FCALL                                      0  $0      
          2        INIT_METHOD_CALL                                         $0, 'protectedMethod'
          3        DO_FCALL                                      0          
   27     4      > RETURN                                                   null

End of function testprotected

Function instance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  instance
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
    8     3*     > RETURN                                                   null

End of function instance

Function publicmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  publicMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                     'AbstractFoo%3A%3ApublicMethod'
   13     1      > RETURN                                                   null

End of function publicmethod

Function protectedmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  protectedMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ECHO                                                     'AbstractFoo%3A%3AprotectedMethod'
   18     1      > RETURN                                                   null

End of function protectedmethod

End of class Foo.

Class Bar:
Function instance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  instance
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
    8     3*     > RETURN                                                   null

End of function instance

Function publicmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  publicMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                     'AbstractFoo%3A%3ApublicMethod'
   13     1      > RETURN                                                   null

End of function publicmethod

Function protectedmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CV0RU
function name:  protectedMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ECHO                                                     'AbstractFoo%3A%3AprotectedMethod'
   18     1      > RETURN                                                   null

End of function protectedmethod

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.53 ms | 1399 KiB | 13 Q