3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected $variable = array('test' => 'hello world!', 'another_test' => 'hello world?'); public function __construct($var) { var_dump($this->variable); // this is the whole array you defined initially $this->variable = $var; // here the $var ('testing contents') overwrites `variable` var_dump($var); // 'testing contents' var_dump($this->variable); // $this->variable is now the same as the argument passed in } } new Test('testing contents');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hPcem
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $0      'Test'
          1        SEND_VAL_EX                                              'testing+contents'
          2        DO_FCALL                                      0          
          3        FREE                                                     $0
          4      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hPcem
function name:  __construct
number of ops:  15
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'var_dump'
          2        FETCH_OBJ_R                                      ~1      'variable'
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
   10     5        ASSIGN_OBJ                                               'variable'
          6        OP_DATA                                                  !0
   11     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   12    10        INIT_FCALL                                               'var_dump'
         11        FETCH_OBJ_R                                      ~5      'variable'
         12        SEND_VAL                                                 ~5
         13        DO_ICALL                                                 
   13    14      > RETURN                                                   null

End of function __construct

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.61 ms | 940 KiB | 16 Q