3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(array( "2"=> 6, "5"=> 1 ), array( "2"=> 1, "5"=> 3 )); $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/ZI6Tl5
function name:  (null)
number of ops:  23
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        INIT_FCALL                                               'array_keys'
          2        INIT_FCALL                                               'reset'
          3        SEND_REF                                                 !0
          4        DO_ICALL                                         $4      
          5        SEND_VAR                                                 $4
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
   13     8        INIT_FCALL                                               'array_combine'
   14     9        SEND_VAR                                                 !1
   15    10        INIT_FCALL                                               'array_map'
   16    11        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         12        BIND_LEXICAL                                             ~7, !0
         13        SEND_VAL                                                 ~7
   17    14        SEND_VAR                                                 !1
   15    15        DO_ICALL                                         $8      
   17    16        SEND_VAR                                                 $8
   13    17        DO_ICALL                                         $9      
         18        ASSIGN                                                   !2, $9
   19    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
         22      > 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/ZI6Tl5
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $k, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     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:
129.13 ms | 1007 KiB | 20 Q