3v4l.org

run code in 300+ PHP versions simultaneously
<?php $r1 = [ 1 => [1, 2, "one"], 2 => [5, 5, "two"], ]; $r2 = [ 1 => [null, 20, "one"], 2 => [1, 0, "two"], ]; $sum = function (array $a1, array $a2) { return array_map( function($e1) { return (is_int($e1) || is_null($e1)) ? array_sum(func_get_args()) : $e1; }, $a1, $a2 ); }; $res = []; foreach ($r1 as $k => $a) { $res[$k] = $sum($r1[$k], $r2[$k]); } var_dump($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 19
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/i10rJ
function name:  (null)
number of ops:  24
compiled vars:  !0 = $r1, !1 = $r2, !2 = $sum, !3 = $res, !4 = $a, !5 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    7     1        ASSIGN                                                   !1, <array>
   12     2        DECLARE_LAMBDA_FUNCTION                          ~8      [0]
          3        ASSIGN                                                   !2, ~8
   23     4        ASSIGN                                                   !3, <array>
   24     5      > FE_RESET_R                                       $11     !0, ->19
          6    > > FE_FETCH_R                                       ~12     $11, !4, ->19
          7    >   ASSIGN                                                   !5, ~12
   25     8        INIT_DYNAMIC_CALL                                        !2
          9        CHECK_FUNC_ARG                                           
         10        FETCH_DIM_FUNC_ARG                               $15     !0, !5
         11        SEND_FUNC_ARG                                            $15
         12        CHECK_FUNC_ARG                                           
         13        FETCH_DIM_FUNC_ARG                               $16     !1, !5
         14        SEND_FUNC_ARG                                            $16
         15        DO_FCALL                                      0  $17     
         16        ASSIGN_DIM                                               !3, !5
         17        OP_DATA                                                  $17
   24    18      > JMP                                                      ->6
         19    >   FE_FREE                                                  $11
   28    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
         23      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i10rJ
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a1, !1 = $a2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        INIT_FCALL                                               'array_map'
   14     3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   16     4        SEND_VAL                                                 ~2
   17     5        SEND_VAR                                                 !0
   18     6        SEND_VAR                                                 !1
   13     7        DO_ICALL                                         $3      
   18     8      > RETURN                                                   $3
   20     9*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/i10rJ
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $e1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        TYPE_CHECK                                   16  ~1      !0
          2      > JMPNZ_EX                                         ~1      ~1, ->5
          3    >   TYPE_CHECK                                    2  ~2      !0
          4        BOOL                                             ~1      ~2
          5    > > JMPZ                                                     ~1, ->12
          6    >   INIT_FCALL                                               'array_sum'
          7        FUNC_GET_ARGS                                    ~3      
          8        SEND_VAL                                                 ~3
          9        DO_ICALL                                         $4      
         10        QM_ASSIGN                                        ~5      $4
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~5      !0
         13    > > RETURN                                                   ~5
   16    14*     > RETURN                                                   null

End of Dynamic Function 0

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
292.71 ms | 1017 KiB | 16 Q