3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ ["2" => 6, "5" => 1], ["2" => 1, "5" => 3], ]; var_export( array_reduce( $array, fn($result, $row) => array_reduce( array_keys($row), fn($res, $k) => isset($res[$k]) && $res[$k] >= $row[$k] ? $res : array_replace($res, [$k => $row[$k]]), $result ), [] ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K1SYq
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array, !1 = $res, !2 = $k
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    8     1        INIT_FCALL                                                   'var_export'
    9     2        INIT_FCALL                                                   'array_reduce'
   10     3        SEND_VAR                                                     !0
   11     4        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          5        BIND_LEXICAL                                                 ~4, !1
          6        BIND_LEXICAL                                                 ~4, !2
   17     7        SEND_VAL                                                     ~4
   18     8        SEND_VAL                                                     <array>
    9     9        DO_ICALL                                             $5      
   18    10        SEND_VAR                                                     $5
    8    11        DO_ICALL                                                     
   20    12      > 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/K1SYq
function name:  {closure:/in/K1SYq:11}
number of ops:  16
compiled vars:  !0 = $result, !1 = $row, !2 = $res, !3 = $k
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
          3        BIND_STATIC                                                  !3
          4        INIT_FCALL                                                   'array_reduce'
   12     5        INIT_FCALL                                                   'array_keys'
          6        SEND_VAR                                                     !1
          7        DO_ICALL                                             $4      
          8        SEND_VAR                                                     $4
   13     9        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
         10        BIND_LEXICAL                                                 ~5, !1
   15    11        SEND_VAL                                                     ~5
   16    12        SEND_VAR                                                     !0
   11    13        DO_ICALL                                             $6      
   16    14      > RETURN                                                       $6
   17    15*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
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: 9
filename:       /in/K1SYq
function name:  {closure:{closure:/in/K1SYq:11}:13}
number of ops:  21
compiled vars:  !0 = $res, !1 = $k, !2 = $row
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
          3        ISSET_ISEMPTY_DIM_OBJ                             0  ~3      !0, !1
          4      > JMPZ_EX                                              ~3      ~3, ->9
          5    >   FETCH_DIM_R                                          ~4      !0, !1
          6        FETCH_DIM_R                                          ~5      !2, !1
          7        IS_SMALLER_OR_EQUAL                                  ~6      ~5, ~4
          8        BOOL                                                 ~3      ~6
          9    > > JMPZ                                                         ~3, ->12
   14    10    >   QM_ASSIGN                                            ~7      !0
         11      > JMP                                                          ->19
   15    12    >   INIT_FCALL                                                   'array_replace'
         13        SEND_VAR                                                     !0
         14        FETCH_DIM_R                                          ~8      !2, !1
         15        INIT_ARRAY                                           ~9      ~8, !1
         16        SEND_VAL                                                     ~9
         17        DO_ICALL                                             $10     
         18        QM_ASSIGN                                            ~7      $10
         19    > > RETURN                                                       ~7
         20*     > RETURN                                                       null

End of Dynamic Function 0

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
193.41 ms | 1594 KiB | 17 Q