3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { protected $thing; public function __construct($thing) { $this->thing = $thing; } public static function create() { return new static('foo'); } } class B extends A { protected $another; public function getAnother() { return $this->another; } public static function create() { $instance = parent::create(); $instance->another = 'bar'; return $instance; } } var_dump(B::create()->getAnother());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KSYat
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_STATIC_METHOD_CALL                                      'B', 'create'
          2        DO_FCALL                                          0  $0      
          3        INIT_METHOD_CALL                                             $0, 'getAnother'
          4        DO_FCALL                                          0  $1      
          5        SEND_VAR                                                     $1
          6        DO_ICALL                                                     
          7      > RETURN                                                       1

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

End of function __construct

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

End of function create

End of class A.

Class B:
Function getanother:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KSYat
function name:  getAnother
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                          ~0      'another'
          1      > RETURN                                                       ~0
   19     2*     > RETURN                                                       null

End of function getanother

Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KSYat
function name:  create
number of ops:  7
compiled vars:  !0 = $instance
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   INIT_STATIC_METHOD_CALL                                      'create'
          1        DO_FCALL                                          0  $1      
          2        ASSIGN                                                       !0, $1
   23     3        ASSIGN_OBJ                                                   !0, 'another'
          4        OP_DATA                                                      'bar'
   24     5      > RETURN                                                       !0
   25     6*     > RETURN                                                       null

End of function create

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

End of function __construct

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.53 ms | 2549 KiB | 14 Q