3v4l.org

run code in 300+ PHP versions simultaneously
<?php class b { protected $object; public function __construct() { $this->object = new \stdClass(); $this->object->name = "default"; } public function setObject(\stdClass $object) { $this->object = $object; } public function getObject() { return $this->object; } public function __clone() { $this->object = clone $this->object; } } class runner { public function run() { $object1 = new stdClass(); $object1->name = "object1"; $object2 = new stdClass(); $object2->name = "object2"; $b1 = new b(); if ($object1 instanceof $b1->object) { $b2 = clone $b1; $b2->object = $object1; echo $b2->getObject()->name; } } } $runner = new runner(); $runner->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WidPb
function name:  (null)
number of ops:  6
compiled vars:  !0 = $runner
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   NEW                                              $1      'runner'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   45     3        INIT_METHOD_CALL                                         !0, 'run'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class b:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WidPb
function name:  __construct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $1      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'object'
          3        OP_DATA                                                  $1
    8     4        FETCH_OBJ_W                                      $3      'object'
          5        ASSIGN_OBJ                                               $3, 'name'
          6        OP_DATA                                                  'default'
    9     7      > RETURN                                                   null

End of function __construct

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

End of function setobject

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

End of function getobject

Function __clone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WidPb
function name:  __clone
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_OBJ_R                                      ~1      'object'
          1        CLONE                                            ~2      ~1
          2        ASSIGN_OBJ                                               'object'
          3        OP_DATA                                                  ~2
   21     4      > RETURN                                                   null

End of function __clone

End of class b.

Class runner:
Function run:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/WidPb
function name:  run
number of ops:  26
compiled vars:  !0 = $object1, !1 = $object2, !2 = $b1, !3 = $b2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $4      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   29     3        ASSIGN_OBJ                                               !0, 'name'
          4        OP_DATA                                                  'object1'
   30     5        NEW                                              $8      'stdClass'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $8
   31     8        ASSIGN_OBJ                                               !1, 'name'
          9        OP_DATA                                                  'object2'
   33    10        NEW                                              $12     'b'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $12
   35    13        FETCH_OBJ_R                                      ~15     !2, 'object'
         14        FETCH_CLASS                                   0  $16     ~15
         15        INSTANCEOF                                               !0, $16
         16      > JMPZ                                                     ~17, ->25
   36    17    >   CLONE                                            ~18     !2
         18        ASSIGN                                                   !3, ~18
   37    19        ASSIGN_OBJ                                               !3, 'object'
         20        OP_DATA                                                  !0
   38    21        INIT_METHOD_CALL                                         !3, 'getObject'
         22        DO_FCALL                                      0  $21     
         23        FETCH_OBJ_R                                      ~22     $21, 'name'
         24        ECHO                                                     ~22
   40    25    > > RETURN                                                   null

End of function run

End of class runner.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151 ms | 1399 KiB | 13 Q