3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyList { private $list = []; function &getList() { return $this->list; } function add($item) { $this->list[] = $item; } } $list = new MyList; $list->add(1); $list->add(2); $arr = &$list->getList(); $arr[] = 3; $arr[] = 4; dd($list->getList()); // array:4 [ // 0 => 1 // 1 => 2 // 2 => 3 // 3 => 4 // ]
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXVQh
function name:  (null)
number of ops:  22
compiled vars:  !0 = $list, !1 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   NEW                                                  $2      'MyList'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   19     3        INIT_METHOD_CALL                                             !0, 'add'
          4        SEND_VAL_EX                                                  1
          5        DO_FCALL                                          0          
   20     6        INIT_METHOD_CALL                                             !0, 'add'
          7        SEND_VAL_EX                                                  2
          8        DO_FCALL                                          0          
   22     9        INIT_METHOD_CALL                                             !0, 'getList'
         10        DO_FCALL                                          0  $7      
         11        ASSIGN_REF                                                   !1, $7
   24    12        ASSIGN_DIM                                                   !1
         13        OP_DATA                                                      3
   25    14        ASSIGN_DIM                                                   !1
         15        OP_DATA                                                      4
   27    16        INIT_FCALL_BY_NAME                                           'dd'
         17        INIT_METHOD_CALL                                             !0, 'getList'
         18        DO_FCALL                                          0  $11     
         19        SEND_VAR_NO_REF_EX                                           $11
         20        DO_FCALL                                          0          
   34    21      > RETURN                                                       1

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

End of function getlist

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

End of function add

End of class MyList.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.99 ms | 3393 KiB | 13 Q