3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Super { protected $child; function setChild(Child $child){ $this->child = $child; if($child->getSuper() !== $this) $child->setSuper($this); } } class Child { protected $super; function setSuper(Super $super){ $this->super = $super; $this->super->addChild($this); } function getSuper(){ return $this->super; } } $super = new Super; $child = new Child; $super->setChild($child); var_dump($super); $super = new Super; $child = new Child; $child->setSuper($super); var_dump($super);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TvcXf
function name:  (null)
number of ops:  25
compiled vars:  !0 = $super, !1 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $2      'Super'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   31     3        NEW                                              $5      'Child'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   32     6        INIT_METHOD_CALL                                         !0, 'setChild'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
   33     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   35    12        NEW                                              $10     'Super'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !0, $10
   36    15        NEW                                              $13     'Child'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !1, $13
   37    18        INIT_METHOD_CALL                                         !1, 'setSuper'
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0          
   38    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Class Super:
Function setchild:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/TvcXf
function name:  setChild
number of ops:  13
compiled vars:  !0 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'child'
          2        OP_DATA                                                  !0
   10     3        INIT_METHOD_CALL                                         !0, 'getSuper'
          4        DO_FCALL                                      0  $2      
          5        FETCH_THIS                                       ~3      
          6        IS_NOT_IDENTICAL                                         $2, ~3
          7      > JMPZ                                                     ~4, ->12
   11     8    >   INIT_METHOD_CALL                                         !0, 'setSuper'
          9        FETCH_THIS                                       $5      
         10        SEND_VAR_EX                                              $5
         11        DO_FCALL                                      0          
   12    12    > > RETURN                                                   null

End of function setchild

End of class Super.

Class Child:
Function setsuper:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TvcXf
function name:  setSuper
number of ops:  9
compiled vars:  !0 = $super
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        ASSIGN_OBJ                                               'super'
          2        OP_DATA                                                  !0
   22     3        FETCH_OBJ_R                                      ~2      'super'
          4        INIT_METHOD_CALL                                         ~2, 'addChild'
          5        FETCH_THIS                                       $3      
          6        SEND_VAR_EX                                              $3
          7        DO_FCALL                                      0          
   23     8      > RETURN                                                   null

End of function setsuper

Function getsuper:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TvcXf
function name:  getSuper
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      'super'
          1      > RETURN                                                   ~0
   27     2*     > RETURN                                                   null

End of function getsuper

End of class Child.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.94 ms | 1400 KiB | 15 Q