3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Command { private $photoIds; private $categoryIds; private function setPhotoIds(int ...$photoIds):self { $this->photoIds = $photoIds; return $this; } private function setCategoryIds(int ...$categoryIds):self { $this->categoryIds = $categoryIds; return $this; } public function __construct(array $photoIds, array $categoryIds) { $this ->setPhotoIds(...$photoIds) ->setCategoryIds(...$categoryIds); } public function getPhotoIds():array { return $this->photoIds; } public function getCategoryIds():array { return $this->categoryIds; } } class Handler { public function __invoke(Command $command) { return array_sum($command->getPhotoIds() + $command->getCategoryIds()); } } $handler = new Handler(); $command = new Command([1, 2], [3, 4]); echo $handler($command);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Biq6o
function name:  (null)
number of ops:  13
compiled vars:  !0 = $handler, !1 = $command
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   NEW                                              $2      'Handler'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   49     3        NEW                                              $5      'Command'
          4        SEND_VAL_EX                                              <array>
          5        SEND_VAL_EX                                              <array>
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   51     8        INIT_DYNAMIC_CALL                                        !0
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $8      
         11        ECHO                                                     $8
         12      > RETURN                                                   1

Class Command:
Function setphotoids:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Biq6o
function name:  setPhotoIds
number of ops:  8
compiled vars:  !0 = $photoIds
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV_VARIADIC                                    !0      
   10     1        ASSIGN_OBJ                                               'photoIds'
          2        OP_DATA                                                  !0
   12     3        FETCH_THIS                                       ~2      
          4        VERIFY_RETURN_TYPE                                       ~2
          5      > RETURN                                                   ~2
   13     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function setphotoids

Function setcategoryids:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Biq6o
function name:  setCategoryIds
number of ops:  8
compiled vars:  !0 = $categoryIds
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV_VARIADIC                                    !0      
   17     1        ASSIGN_OBJ                                               'categoryIds'
          2        OP_DATA                                                  !0
   19     3        FETCH_THIS                                       ~2      
          4        VERIFY_RETURN_TYPE                                       ~2
          5      > RETURN                                                   ~2
   20     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function setcategoryids

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Biq6o
function name:  __construct
number of ops:  11
compiled vars:  !0 = $photoIds, !1 = $categoryIds
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2        INIT_METHOD_CALL                                         'setPhotoIds'
          3        SEND_UNPACK                                              !0
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      1  $2      
   26     6        INIT_METHOD_CALL                                         $2, 'setCategoryIds'
          7        SEND_UNPACK                                              !1
          8        CHECK_UNDEF_ARGS                                         
          9        DO_FCALL                                      1          
   27    10      > RETURN                                                   null

End of function __construct

Function getphotoids:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Biq6o
function name:  getPhotoIds
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~0      'photoIds'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   32     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getphotoids

Function getcategoryids:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Biq6o
function name:  getCategoryIds
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   FETCH_OBJ_R                                      ~0      'categoryIds'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   37     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getcategoryids

End of class Command.

Class Handler:
Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Biq6o
function name:  __invoke
number of ops:  11
compiled vars:  !0 = $command
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
   44     1        INIT_FCALL                                               'array_sum'
          2        INIT_METHOD_CALL                                         !0, 'getPhotoIds'
          3        DO_FCALL                                      0  $1      
          4        INIT_METHOD_CALL                                         !0, 'getCategoryIds'
          5        DO_FCALL                                      0  $2      
          6        ADD                                              ~3      $1, $2
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                         $4      
          9      > RETURN                                                   $4
   45    10*     > RETURN                                                   null

End of function __invoke

End of class Handler.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.64 ms | 1400 KiB | 15 Q