3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function sum(array $ints): int { (function (int ...$ints) {})(...$ints); return array_sum($ints); } var_dump(sum([1, 2, 3])); var_dump(sum([1, 2, "three"]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Em1Uq
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'sum'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   11     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'sum'
          8        SEND_VAL                                                 <array>
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function sum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Em1Uq
function name:  sum
number of ops:  13
compiled vars:  !0 = $ints
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        DECLARE_LAMBDA_FUNCTION                          ~1      [0]
          2        INIT_DYNAMIC_CALL                                        ~1
          3        SEND_UNPACK                                              !0
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      1          
    7     6        INIT_FCALL                                               'array_sum'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $3      
          9        VERIFY_RETURN_TYPE                                       $3
         10      > RETURN                                                   $3
    8    11*       VERIFY_RETURN_TYPE                                       
         12*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Em1Uq
function name:  {closure}
number of ops:  2
compiled vars:  !0 = $ints
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_VARIADIC                                    !0      
          1      > RETURN                                                   null

End of Dynamic Function 0

End of function sum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
286.64 ms | 1018 KiB | 17 Q