3v4l.org

run code in 300+ PHP versions simultaneously
<?php $d = [ ['foo' => 1, 'bar' => 2], ['foo' => 1, 'bar' => 3], ['foo' => 2, 'bar' => 4] ]; $result = array_values(array_merge(...array_map(fn($v) => [array_key_first($v). '|'. $v[array_key_first($v)] => $v], $d))); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2pbGd
function name:  (null)
number of ops:  18
compiled vars:  !0 = $d, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        INIT_FCALL                                               'array_values'
          2        INIT_FCALL                                               'array_merge'
          3        INIT_FCALL                                               'array_map'
          4        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          5        SEND_VAL                                                 ~3
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        SEND_UNPACK                                              $4
          9        CHECK_UNDEF_ARGS                                         
         10        DO_ICALL                                         $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                         $6      
         13        ASSIGN                                                   !1, $6
   11    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                                 
         17      > 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/2pbGd
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'array_key_first'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        CONCAT                                           ~2      $1, '%7C'
          5        INIT_FCALL                                               'array_key_first'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        FETCH_DIM_R                                      ~4      !0, $3
          9        CONCAT                                           ~5      ~2, ~4
         10        INIT_ARRAY                                       ~6      !0, ~5
         11      > RETURN                                                   ~6
         12*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.91 ms | 1010 KiB | 18 Q