3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected $protectedVariable; public function __construct() { $this->protectedVariable = 'this belongs to test class'; } } $x = new class (5) extends Test { public $holder; public function __construct($classArg) { parent::__construct(); $this->holder = $classArg; } public function multiplyByNo($multiplier) { return $this->holder * $multiplier; } public function getParentVar() { return $this->protectedVariable(); } }; var_dump($x->multiplyByNo(10)); var_dump($x->getParentVar());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DR9l9
function name:  (null)
number of ops:  17
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_ANON_CLASS                               <undef> 'test'
          1        NEW                                              $2      $1
          2        SEND_VAL_EX                                              5
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   32     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'multiplyByNo'
          7        SEND_VAL_EX                                              10
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                                 
   33    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'getParentVar'
         13        DO_FCALL                                      0  $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DR9l9
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                               'protectedVariable'
          1        OP_DATA                                                  'this+belongs+to+test+class'
   10     2      > RETURN                                                   null

End of function __construct

End of class Test.

Class Test@anonymous:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DR9l9
function name:  __construct
number of ops:  6
compiled vars:  !0 = $classArg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        INIT_STATIC_METHOD_CALL                                  
          2        DO_FCALL                                      0          
   18     3        ASSIGN_OBJ                                               'holder'
          4        OP_DATA                                                  !0
   19     5      > RETURN                                                   null

End of function __construct

Function multiplybyno:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DR9l9
function name:  multiplyByNo
number of ops:  5
compiled vars:  !0 = $multiplier
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        FETCH_OBJ_R                                      ~1      'holder'
          2        MUL                                              ~2      !0, ~1
          3      > RETURN                                                   ~2
   24     4*     > RETURN                                                   null

End of function multiplybyno

Function getparentvar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DR9l9
function name:  getParentVar
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_METHOD_CALL                                         'protectedVariable'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   29     3*     > RETURN                                                   null

End of function getparentvar

End of class Test@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.39 ms | 1400 KiB | 15 Q