3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyArray { private $arrayRef; function __construct(&$array){ $this->arrayRef =& $array; } function addElement($newElement){ $this->arrayRef[] = $newElement; } function print(){ print_r($this->arrayRef); } } $array = ['first', 'second']; $arrayObject = new MyArray($array); $arrayObject->addElement('treci'); print_r($array); // prints array containing 2 elements echo '<br/>'; $arrayObject->print(); // prints array containing 3 elements
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XH54F
function name:  (null)
number of ops:  15
compiled vars:  !0 = $array, !1 = $arrayObject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   21     1        NEW                                              $3      'MyArray'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   22     5        INIT_METHOD_CALL                                         !1, 'addElement'
          6        SEND_VAL_EX                                              'treci'
          7        DO_FCALL                                      0          
   24     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   25    11        ECHO                                                     '%3Cbr%2F%3E'
   26    12        INIT_METHOD_CALL                                         !1, 'print'
         13        DO_FCALL                                      0          
         14      > RETURN                                                   1

Class MyArray:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XH54F
function name:  __construct
number of ops:  4
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ_REF                                           'arrayRef'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function __construct

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

End of function addelement

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

End of function print

End of class MyArray.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.95 ms | 1003 KiB | 14 Q