3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $consumer; public function getConsumer() { var_dump(__METHOD__); return $this->consumer; } public function setConsumer($val) { $this->consumer = $val; } } class B extends A { protected $consumer; public function __construct($val) { $this->consumer = $val; } public function test() { var_dump(__METHOD__); return $this->consumer; } } var_dump("Construct B with 'B'"); $b = new B("B"); var_dump($b->test()); var_dump($b->getConsumer()); var_dump("B::setConsumer('A')"); $b->setConsumer("A"); var_dump($b->getConsumer()); var_dump($b->test());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sdGck
function name:  (null)
number of ops:  34
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'Construct+B+with+%27B%27'
          2        DO_ICALL                                                 
   35     3        NEW                                              $2      'B'
          4        SEND_VAL_EX                                              'B'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   36     7        INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !0, 'test'
          9        DO_FCALL                                      0  $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                                 
   37    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !0, 'getConsumer'
         14        DO_FCALL                                      0  $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                                 
   39    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAL                                                 'B%3A%3AsetConsumer%28%27A%27%29'
         19        DO_ICALL                                                 
   40    20        INIT_METHOD_CALL                                         !0, 'setConsumer'
         21        SEND_VAL_EX                                              'A'
         22        DO_FCALL                                      0          
   41    23        INIT_FCALL                                               'var_dump'
         24        INIT_METHOD_CALL                                         !0, 'getConsumer'
         25        DO_FCALL                                      0  $11     
         26        SEND_VAR                                                 $11
         27        DO_ICALL                                                 
   42    28        INIT_FCALL                                               'var_dump'
         29        INIT_METHOD_CALL                                         !0, 'test'
         30        DO_FCALL                                      0  $13     
         31        SEND_VAR                                                 $13
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Class A:
Function getconsumer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sdGck
function name:  getConsumer
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'A%3A%3AgetConsumer'
          2        DO_ICALL                                                 
    9     3        FETCH_OBJ_R                                      ~1      'consumer'
          4      > RETURN                                                   ~1
   10     5*     > RETURN                                                   null

End of function getconsumer

Function setconsumer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sdGck
function name:  setConsumer
number of ops:  4
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        ASSIGN_OBJ                                               'consumer'
          2        OP_DATA                                                  !0
   15     3      > RETURN                                                   null

End of function setconsumer

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sdGck
function name:  __construct
number of ops:  4
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        ASSIGN_OBJ                                               'consumer'
          2        OP_DATA                                                  !0
   24     3      > RETURN                                                   null

End of function __construct

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sdGck
function name:  test
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'B%3A%3Atest'
          2        DO_ICALL                                                 
   29     3        FETCH_OBJ_R                                      ~1      'consumer'
          4      > RETURN                                                   ~1
   30     5*     > RETURN                                                   null

End of function test

Function getconsumer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sdGck
function name:  getConsumer
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'A%3A%3AgetConsumer'
          2        DO_ICALL                                                 
    9     3        FETCH_OBJ_R                                      ~1      'consumer'
          4      > RETURN                                                   ~1
   10     5*     > RETURN                                                   null

End of function getconsumer

Function setconsumer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sdGck
function name:  setConsumer
number of ops:  4
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        ASSIGN_OBJ                                               'consumer'
          2        OP_DATA                                                  !0
   15     3      > RETURN                                                   null

End of function setconsumer

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.76 ms | 1404 KiB | 15 Q