3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X{ public $real = []; public function __construct(){ $this->real ['qty']= 15; } public function &setData(){ return $this->real; } } $x = new X(); $x->setData()['qty'] = 22; $x->setData()['qty2'] = 'haha yeah, we should not use refs :)'; var_dump($x->real);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O8GOE
function name:  (null)
number of ops:  18
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'X'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3        INIT_METHOD_CALL                                         !0, 'setData'
          4        DO_FCALL                                      0  $4      
          5        SEPARATE                                         $4      $4
          6        ASSIGN_DIM                                               $4, 'qty'
          7        OP_DATA                                                  22
   16     8        INIT_METHOD_CALL                                         !0, 'setData'
          9        DO_FCALL                                      0  $6      
         10        SEPARATE                                         $6      $6
         11        ASSIGN_DIM                                               $6, 'qty2'
         12        OP_DATA                                                  'haha+yeah%2C+we+should+not+use+refs+%3A%29'
   17    13        INIT_FCALL                                               'var_dump'
         14        FETCH_OBJ_R                                      ~8      !0, 'real'
         15        SEND_VAL                                                 ~8
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class X:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O8GOE
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_W                                      $0      'real'
          1        ASSIGN_DIM                                               $0, 'qty'
          2        OP_DATA                                                  15
    8     3      > RETURN                                                   null

End of function __construct

Function setdata:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/O8GOE
function name:  setData
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_W                                      $0      'real'
          1      > RETURN_BY_REF                                            $0
   11     2*     > RETURN_BY_REF                                            null

End of function setdata

End of class X.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.69 ms | 1396 KiB | 15 Q