3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $name = 'a'; private $value = null; public function __construct() { $this->value = 1; } } class B { public $name = 'b'; private $differentValue = null; public function __construct() { $this->differentValue = 1; } } class CD { private $parent = null; public function __construct($parent) { $this->parent = new $parent; } public function __call($name, $params) { if ( is_callable(array($this->parent, $name)) ) { return call_user_func_array(array($this->parent, $name), $params); } else { throw new Exception('Method "'.$name.'" should be callable.'); } } public function __get($property_name){ if(isset($this->$property_name)) { return $this->$property_name; } elseif (isset($this->parent->$property_name)) { return $this->parent->$property_name; } else { return null; } } public function display() { echo "OK"; } } $c = new CD(new B); var_dump($c->name);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ns6q7
function name:  (null)
number of ops:  11
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E >   NEW                                              $1      'CD'
          1        NEW                                              $2      'B'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   59     6        INIT_FCALL                                               'var_dump'
          7        FETCH_OBJ_R                                      ~6      !0, 'name'
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ns6q7
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN_OBJ                                               'value'
          1        OP_DATA                                                  1
    9     2      > RETURN                                                   null

End of function __construct

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/ns6q7
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN_OBJ                                               'differentValue'
          1        OP_DATA                                                  1
   19     2      > RETURN                                                   null

End of function __construct

End of class B.

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

End of function __construct

Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/ns6q7
function name:  __call
number of ops:  25
compiled vars:  !0 = $name, !1 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   32     2        INIT_FCALL                                               'is_callable'
          3        FETCH_OBJ_R                                      ~2      'parent'
          4        INIT_ARRAY                                       ~3      ~2
          5        ADD_ARRAY_ELEMENT                                ~3      !0
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8      > JMPZ                                                     $4, ->18
   33     9    >   FETCH_OBJ_R                                      ~5      'parent'
         10        INIT_ARRAY                                       ~6      ~5
         11        ADD_ARRAY_ELEMENT                                ~6      !0
         12        INIT_USER_CALL                                0          'call_user_func_array', ~6
         13        SEND_ARRAY                                               !1
         14        CHECK_UNDEF_ARGS                                         
         15        DO_FCALL                                      0  $7      
         16      > RETURN                                                   $7
         17*       JMP                                                      ->24
   35    18    >   NEW                                              $8      'Exception'
         19        CONCAT                                           ~9      'Method+%22', !0
         20        CONCAT                                           ~10     ~9, '%22+should+be+callable.'
         21        SEND_VAL_EX                                              ~10
         22        DO_FCALL                                      0          
         23      > THROW                                         0          $8
   37    24*     > RETURN                                                   null

End of function __call

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ns6q7
function name:  __get
number of ops:  15
compiled vars:  !0 = $property_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
   40     1        ISSET_ISEMPTY_PROP_OBJ                                   !0
          2      > JMPZ                                                     ~1, ->6
   41     3    >   FETCH_OBJ_R                                      ~2      !0
          4      > RETURN                                                   ~2
          5*       JMP                                                      ->14
   42     6    >   FETCH_OBJ_IS                                     ~3      'parent'
          7        ISSET_ISEMPTY_PROP_OBJ                                   ~3, !0
          8      > JMPZ                                                     ~4, ->13
   43     9    >   FETCH_OBJ_R                                      ~5      'parent'
         10        FETCH_OBJ_R                                      ~6      ~5, !0
         11      > RETURN                                                   ~6
         12*       JMP                                                      ->14
   45    13    > > RETURN                                                   null
   47    14*     > RETURN                                                   null

End of function __get

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

End of function display

End of class CD.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.42 ms | 1404 KiB | 17 Q