3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { protected $val; public function __construct($newVal = 'default') { $this->val = $newVal; } public function output(MyClass $subject) { echo $subject->val, "\n"; } } $obj1 = new MyClass(); $obj2 = new MyClass("hello world"); $obj1->output($obj2); // Output: hello world
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8K0Nr
function name:  (null)
number of ops:  11
compiled vars:  !0 = $obj1, !1 = $obj2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'MyClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   19     3        NEW                                              $5      'MyClass'
          4        SEND_VAL_EX                                              'hello+world'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   21     7        INIT_METHOD_CALL                                         !0, 'output'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
   22    10      > RETURN                                                   1

Class MyClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8K0Nr
function name:  __construct
number of ops:  4
compiled vars:  !0 = $newVal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      'default'
    9     1        ASSIGN_OBJ                                               'val'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function __construct

Function output:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8K0Nr
function name:  output
number of ops:  5
compiled vars:  !0 = $subject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        FETCH_OBJ_R                                      ~1      !0, 'val'
          2        ECHO                                                     ~1
          3        ECHO                                                     '%0A'
   15     4      > RETURN                                                   null

End of function output

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.57 ms | 1394 KiB | 13 Q