3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [0 => 1, 1 => 5, 3 => null], [0 => 4, 1 => null, 3 => null], [0 => null, 1 => 5, 3 => 5] ]; $result = []; array_walk_recursive( $array, function($v, $k) use(&$result) { $result[$k] = ($result[$k] ?? 0) + ($v !== null); } ); var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cTpsR
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   10     2        INIT_FCALL                                               'array_walk_recursive'
   11     3        SEND_REF                                                 !0
   12     4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !1
   14     6        SEND_VAL                                                 ~4
   10     7        DO_ICALL                                                 
   16     8        INIT_FCALL                                               'var_export'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > 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/cTpsR
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $v, !1 = $k, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   13     3        FETCH_DIM_IS                                     ~4      !2, !1
          4        COALESCE                                         ~5      ~4
          5        QM_ASSIGN                                        ~5      0
          6        TYPE_CHECK                                  1020  ~6      !0
          7        ADD                                              ~7      ~5, ~6
          8        ASSIGN_DIM                                               !2, !1
          9        OP_DATA                                                  ~7
   14    10      > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.94 ms | 1001 KiB | 15 Q