3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A{ public function sum($num1, $num2){ return $num1 + $num2; } } class B { public $property; public function __construct( A $object=null) { $property = $object; } } $test = new B(); echo $test->$property->sum(1,2); // output 3
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kkqnZ
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test, !1 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $2      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   18     3        FETCH_OBJ_R                                      ~5      !0, !1
          4        INIT_METHOD_CALL                                         ~5, 'sum'
          5        SEND_VAL_EX                                              1
          6        SEND_VAL_EX                                              2
          7        DO_FCALL                                      0  $6      
          8        ECHO                                                     $6
          9      > RETURN                                                   1

Class A:
Function sum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kkqnZ
function name:  sum
number of ops:  5
compiled vars:  !0 = $num1, !1 = $num2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ADD                                              ~2      !0, !1
          3      > RETURN                                                   ~2
    5     4*     > RETURN                                                   null

End of function sum

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kkqnZ
function name:  __construct
number of ops:  3
compiled vars:  !0 = $object, !1 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV_INIT                                        !0      null
   12     1        ASSIGN                                                   !1, !0
   13     2      > RETURN                                                   null

End of function __construct

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.94 ms | 1394 KiB | 13 Q