3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Calculate; class calculator{ public function sum(...$args) { return array_sum($args); } public function init(){ return $this->sum(5, 10); } } $cal = new calculator(); print $cal->init(); // Expected Output is 15
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pjhRa
function name:  (null)
number of ops:  7
compiled vars:  !0 = $cal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $1      'Calculate%5Ccalculator'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   12     3        INIT_METHOD_CALL                                         !0, 'init'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
          6      > RETURN                                                   1

Class Calculate\calculator:
Function sum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pjhRa
function name:  sum
number of ops:  6
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_VARIADIC                                    !0      
          1        INIT_NS_FCALL_BY_NAME                                    'Calculate%5Carray_sum'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of function sum

Function init:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pjhRa
function name:  init
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_METHOD_CALL                                         'sum'
          1        SEND_VAL_EX                                              5
          2        SEND_VAL_EX                                              10
          3        DO_FCALL                                      0  $0      
          4      > RETURN                                                   $0
    9     5*     > RETURN                                                   null

End of function init

End of class Calculate\calculator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.13 ms | 997 KiB | 14 Q