3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { var $my_public = array(); //forward php4 to constructor function foo($one, $two) { $this->my_public[] = 'php4 constructor'; return $this->__construct($one, $two); } //constructor php5 function __construct($one, $two) { $this->my_public[] = 'php5 constructor'; $this->my_public[] = $one; $this->my_public[] = $two; register_shutdown_function(array(&$this, "__destruct")); } function dump() { print_r($this->my_public); } function __destruct () {} } $test = new foo('een', 'twee'); $test->dump();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xi7JO
function name:  (null)
number of ops:  8
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $1      'foo'
          1        SEND_VAL_EX                                              'een'
          2        SEND_VAL_EX                                              'twee'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   33     5        INIT_METHOD_CALL                                         !0, 'dump'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class foo:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xi7JO
function name:  foo
number of ops:  11
compiled vars:  !0 = $one, !1 = $two
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        FETCH_OBJ_W                                      $2      'my_public'
          3        ASSIGN_DIM                                               $2
          4        OP_DATA                                                  'php4+constructor'
   11     5        INIT_METHOD_CALL                                         '__construct'
          6        SEND_VAR_EX                                              !0
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0  $4      
          9      > RETURN                                                   $4
   12    10*     > RETURN                                                   null

End of function foo

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xi7JO
function name:  __construct
number of ops:  18
compiled vars:  !0 = $one, !1 = $two
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        FETCH_OBJ_W                                      $2      'my_public'
          3        ASSIGN_DIM                                               $2
          4        OP_DATA                                                  'php5+constructor'
   18     5        FETCH_OBJ_W                                      $4      'my_public'
          6        ASSIGN_DIM                                               $4
          7        OP_DATA                                                  !0
   19     8        FETCH_OBJ_W                                      $6      'my_public'
          9        ASSIGN_DIM                                               $6
         10        OP_DATA                                                  !1
   21    11        INIT_FCALL                                               'register_shutdown_function'
         12        FETCH_THIS                                       $8      
         13        INIT_ARRAY                                       ~9      $8
         14        ADD_ARRAY_ELEMENT                                ~9      '__destruct'
         15        SEND_VAL                                                 ~9
         16        DO_ICALL                                                 
   22    17      > RETURN                                                   null

End of function __construct

Function dump:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xi7JO
function name:  dump
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'print_r'
          1        FETCH_OBJ_R                                      ~0      'my_public'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   25     4      > RETURN                                                   null

End of function dump

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

End of function __destruct

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.85 ms | 1400 KiB | 17 Q