3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'GB' => 20827, 'US' => 73, 'ES' => 23, 'AU' => 15, 'DE' => 12, 'MY' => 4, 'QA' => 1, 'VN' => 1, 'SK' => 1, 'FJ' => 1, 'ME' => 1, 'TR' => 1, 'LV' => 1 ], [ 'GB' => 15070, 'US' => 3920, 'IE' => 1711, 'PH' => 1071, 'MT' => 578, 'AU' => 423, 'HR' => 241, 'ZA' => 210, 'FR' => 139 ] ]; $result = array_shift($array); array_walk_recursive( $array, function($value, $key) use(&$result) { $result[$key] = ($result[$key] ?? 0) + $value; } ); var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jaIPL
function name:  (null)
number of ops:  15
compiled vars:  !0 = $array, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   32     1        INIT_FCALL                                               'array_shift'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   33     5        INIT_FCALL                                               'array_walk_recursive'
   34     6        SEND_REF                                                 !0
   35     7        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          8        BIND_LEXICAL                                             ~5, !1
   37     9        SEND_VAL                                                 ~5
   33    10        DO_ICALL                                                 
   39    11        INIT_FCALL                                               'var_export'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
         14      > 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/jaIPL
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $value, !1 = $key, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   36     3        FETCH_DIM_IS                                     ~4      !2, !1
          4        COALESCE                                         ~5      ~4
          5        QM_ASSIGN                                        ~5      0
          6        ADD                                              ~6      ~5, !0
          7        ASSIGN_DIM                                               !2, !1
          8        OP_DATA                                                  ~6
   37     9      > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.24 ms | 1002 KiB | 16 Q