3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $property = array('test value '); public function & getProperty() { return $this->property; } public function __destruct() { echo "Test is destroying itself..."; $this->property = array(); } } class TestConsumer { private $test; public function __construct(Test $test) { $this->test = & $test->getProperty(); } public function doSomething() { echo $this->test[0]; } } $test = new Test(); $test = new TestConsumer($test); $test->doSomething(); gc_disable(); $test = new Test(); $test = new TestConsumer($test); $test->doSomething(); gc_enable();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fPdOW
function name:  (null)
number of ops:  23
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   36     3        NEW                                              $4      'TestConsumer'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $4
   37     7        INIT_METHOD_CALL                                         !0, 'doSomething'
          8        DO_FCALL                                      0          
   39     9        INIT_FCALL                                               'gc_disable'
         10        DO_ICALL                                                 
   40    11        NEW                                              $9      'Test'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !0, $9
   41    14        NEW                                              $12     'TestConsumer'
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !0, $12
   42    18        INIT_METHOD_CALL                                         !0, 'doSomething'
         19        DO_FCALL                                      0          
   43    20        INIT_FCALL                                               'gc_enable'
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Class Test:
Function getproperty:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/fPdOW
function name:  getProperty
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_W                                      $0      'property'
          1      > RETURN_BY_REF                                            $0
   10     2*     > RETURN_BY_REF                                            null

End of function getproperty

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fPdOW
function name:  __destruct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ECHO                                                     'Test+is+destroying+itself...'
   15     1        ASSIGN_OBJ                                               'property'
          2        OP_DATA                                                  <array>
   16     3      > RETURN                                                   null

End of function __destruct

End of class Test.

Class TestConsumer:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fPdOW
function name:  __construct
number of ops:  7
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   25     1        INIT_METHOD_CALL                                         !0, 'getProperty'
          2        DO_FCALL                                      0  $2      
          3        MAKE_REF                                         $3      $2
          4        ASSIGN_OBJ_REF                                           'test'
          5        OP_DATA                                                  $3
   26     6      > RETURN                                                   null

End of function __construct

Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fPdOW
function name:  doSomething
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   FETCH_OBJ_R                                      ~0      'test'
          1        FETCH_DIM_R                                      ~1      ~0, 0
          2        ECHO                                                     ~1
   31     3      > RETURN                                                   null

End of function dosomething

End of class TestConsumer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.82 ms | 1400 KiB | 17 Q