3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { private $field; public function setField($field) { $this->field = $field; } public function getField() { return $this->field; } } $test1 = new Test(); $test2 = new Test(); $test1->setField(10); $arr = array(); $arr[] = $test1; $arr[] = $test2; var_dump($arr); //$arr[0]->setField(10); //$arr[1]->setField(20);
based on mqYfs
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/KSkR3
function name:  (null)
number of ops:  19
compiled vars:  !0 = $test1, !1 = $test2, !2 = $arr
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
  13     1        NEW                                              $4      :-6
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $4
  14     4        NEW                                              $7      :-4
         5        DO_FCALL                                      0          
         6        ASSIGN                                                   !1, $7
  16     7        INIT_METHOD_CALL                                         !0, 'setField'
         8        SEND_VAL_EX                                              10
         9        DO_FCALL                                      0          
  18    10        ASSIGN                                                   !2, <array>
  19    11        ASSIGN_DIM                                               !2
        12        OP_DATA                                                  !0
  20    13        ASSIGN_DIM                                               !2
        14        OP_DATA                                                  !1
  23    15        INIT_FCALL                                               'var_dump'
        16        SEND_VAR                                                 !2
        17        DO_ICALL                                                 
        18      > RETURN                                                   1

Class Test:
Function setfield:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/KSkR3
function name:  setField
number of ops:  4
compiled vars:  !0 = $field
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E >   RECV                                             !0      
   6     1        ASSIGN_OBJ                                               'field'
         2        OP_DATA                                                  !0
   7     3      > RETURN                                                   null

End of function setfield

Function getfield:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/KSkR3
function name:  getField
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   9     0  E >   FETCH_OBJ_R                                      $0      'field'
         1      > RETURN                                                   $0
  10     2*     > RETURN                                                   null

End of function getfield

End of class Test.

Generated using Vulcan Logic Dumper, using php 7.2.0