3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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_dum($this->variable); // $this->variable is now the same as the argument passed in } } new Test('testing contents');
based on uackm
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9mS8P
function name:  (null)
number of ops:  6
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  16     1        NEW                                              $1      :-5
         2        SEND_VAL_EX                                              'testing+contents'
         3        DO_FCALL                                      0          
         4        FREE                                                     $1
         5      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9mS8P
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_VAR                                                 $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_BY_NAME                                       'var_dum'
        11        FETCH_OBJ_FUNC_ARG                               $5      'variable'
        12        SEND_VAR_EX                                              $5
        13        DO_FCALL                                      0          
  13    14      > RETURN                                                   null

End of function __construct

End of class Test.

Generated using Vulcan Logic Dumper, using php 7.3.0