3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(array( "2"=> 6, "5"=> 1 ), array( "2"=> 1, "5"=> 3 )); $arr = []; $keys = array_keys(reset($arr) ?: []); $res = array_combine( $keys, array_map( fn ($k) => max(array_column($arr, $k)), $keys) ); print_r($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v3efA
function name:  (null)
number of ops:  26
compiled vars:  !0 = $arr, !1 = $keys, !2 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !0, <array>
   13     2        INIT_FCALL                                               'array_keys'
          3        INIT_FCALL                                               'reset'
          4        SEND_REF                                                 !0
          5        DO_ICALL                                         $5      
          6        JMP_SET                                          ~6      $5, ->8
          7        QM_ASSIGN                                        ~6      <array>
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !1, $7
   14    11        INIT_FCALL                                               'array_combine'
   15    12        SEND_VAR                                                 !1
   16    13        INIT_FCALL                                               'array_map'
   17    14        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
         15        BIND_LEXICAL                                             ~9, !0
         16        SEND_VAL                                                 ~9
   18    17        SEND_VAR                                                 !1
   16    18        DO_ICALL                                         $10     
   18    19        SEND_VAR                                                 $10
   14    20        DO_ICALL                                         $11     
         21        ASSIGN                                                   !2, $11
   20    22        INIT_FCALL                                               'print_r'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                                 
         25      > 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/v3efA
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $k, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'max'
          3        INIT_FCALL                                               'array_column'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                         $3      
          9      > RETURN                                                   $3
         10*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.28 ms | 1018 KiB | 20 Q