3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Super { public $child; function setChild(Child $child){ echo "setting child to super\n"; $this->child = $child; if($child->getSuper() !== $this) $child->setSuper($this); } function getChild(){ return $this->child; } } class Child { public $super; function setSuper(Super $super){ echo "setting super to child\n"; $this->super = $super; if($super->getChild() !== $this) $this->super->setChild($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/s2151
function name:  (null)
number of ops:  25
compiled vars:  !0 = $super, !1 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   NEW                                              $2      'Super'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   36     3        NEW                                              $5      'Child'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   37     6        INIT_METHOD_CALL                                         !0, 'setChild'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
   38     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   40    12        NEW                                              $10     'Super'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !0, $10
   41    15        NEW                                              $13     'Child'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !1, $13
   42    18        INIT_METHOD_CALL                                         !1, 'setSuper'
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0          
   43    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 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/s2151
function name:  setChild
number of ops:  14
compiled vars:  !0 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ECHO                                                     'setting+child+to+super%0A'
    9     2        ASSIGN_OBJ                                               'child'
          3        OP_DATA                                                  !0
   10     4        INIT_METHOD_CALL                                         !0, 'getSuper'
          5        DO_FCALL                                      0  $2      
          6        FETCH_THIS                                       ~3      
          7        IS_NOT_IDENTICAL                                         $2, ~3
          8      > JMPZ                                                     ~4, ->13
   11     9    >   INIT_METHOD_CALL                                         !0, 'setSuper'
         10        FETCH_THIS                                       $5      
         11        SEND_VAR_EX                                              $5
         12        DO_FCALL                                      0          
   12    13    > > RETURN                                                   null

End of function setchild

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

End of function getchild

End of class Super.

Class Child:
Function setsuper:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/s2151
function name:  setSuper
number of ops:  15
compiled vars:  !0 = $super
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1        ECHO                                                     'setting+super+to+child%0A'
   25     2        ASSIGN_OBJ                                               'super'
          3        OP_DATA                                                  !0
   26     4        INIT_METHOD_CALL                                         !0, 'getChild'
          5        DO_FCALL                                      0  $2      
          6        FETCH_THIS                                       ~3      
          7        IS_NOT_IDENTICAL                                         $2, ~3
          8      > JMPZ                                                     ~4, ->14
   27     9    >   FETCH_OBJ_R                                      ~5      'super'
         10        INIT_METHOD_CALL                                         ~5, 'setChild'
         11        FETCH_THIS                                       $6      
         12        SEND_VAR_EX                                              $6
         13        DO_FCALL                                      0          
   28    14    > > 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/s2151
function name:  getSuper
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~0      'super'
          1      > RETURN                                                   ~0
   32     2*     > RETURN                                                   null

End of function getsuper

End of class Child.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.84 ms | 1400 KiB | 15 Q