3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = Array ( 0 => Array ( 'entry_id' => 1, 'ic' => 2147483647, 'name' => 'Kořínková Blanka', 'residency' => 'Štětí, Lukešova 354, 411 08', 'file_no' => 'KSUL 77 INS 18898 / 2013', 'detail' => '749371da-725c-4738-8def-2f7167142a6f' ), 1 => Array ( 'entry_id' => 1, 'ic' => 2147483647, 'name' => 'Kořínková Blanka', 'residency' => 'Štětí, Lukešova 354, 411 08', 'file_no' => 'KSUL 77 INS 21218 / 2013', 'detail' => '43b6a718-4647-451d-9c53-50dfee8403ff' ), 2 => Array ( 'entry_id' => 2, 'ic' => 46900217, 'name' => 'ENTEC a.s. "v likvidaci"', 'residency' => 'Staré Město, Brněnská 1916, 686 03', 'file_no' => 'KSBR 28 INS 1232 / 2013', 'detail' => 'e2155a52-c464-4357-b71b-4f4ff75585eb' ) ); $mergeId = 'entry_id'; $data = array_reduce($data, function($c, $x) use ($mergeId) { $c[$x[$mergeId]] = isset($c[$x[$mergeId]]) ?array_combine( $z=array_keys($c[$x[$mergeId]]), array_map(function($y) use ($x, $c, $mergeId) { return in_array($x[$y], (array)$c[$x[$mergeId]][$y]) ?$c[$x[$mergeId]][$y] :array_merge((array)$c[$x[$mergeId]][$y], [$x[$y]]); }, $z) ) :$x; return $c; }, []); var_dump($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uQCs
function name:  (null)
number of ops:  14
compiled vars:  !0 = $data, !1 = $mergeId
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   37     1        ASSIGN                                                   !1, 'entry_id'
   39     2        INIT_FCALL                                               'array_reduce'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F4uQCs%3A39%240'
          5        BIND_LEXICAL                                             ~4, !1
   53     6        SEND_VAL                                                 ~4
          7        SEND_VAL                                                 <array>
          8        DO_ICALL                                         $5      
   39     9        ASSIGN                                                   !0, $5
   56    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F4uQCs%3A39%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 27
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uQCs
function name:  {closure}
number of ops:  32
compiled vars:  !0 = $c, !1 = $x, !2 = $mergeId, !3 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   41     3        FETCH_DIM_R                                      ~4      !1, !2
          4        FETCH_DIM_R                                      ~6      !1, !2
          5        ISSET_ISEMPTY_DIM_OBJ                         0          !0, ~6
          6      > JMPZ                                                     ~7, ->27
   42     7    >   INIT_FCALL                                               'array_combine'
   43     8        INIT_FCALL                                               'array_keys'
          9        FETCH_DIM_R                                      ~8      !1, !2
         10        FETCH_DIM_R                                      ~9      !0, ~8
         11        SEND_VAL                                                 ~9
         12        DO_ICALL                                         $10     
         13        ASSIGN                                           ~11     !3, $10
         14        SEND_VAL                                                 ~11
   44    15        INIT_FCALL                                               'array_map'
         16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F4uQCs%3A44%241'
         17        BIND_LEXICAL                                             ~12, !1
         18        BIND_LEXICAL                                             ~12, !0
         19        BIND_LEXICAL                                             ~12, !2
   49    20        SEND_VAL                                                 ~12
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $13     
         23        SEND_VAR                                                 $13
         24        DO_ICALL                                         $14     
         25        QM_ASSIGN                                        ~15     $14
         26      > JMP                                                      ->28
   51    27    >   QM_ASSIGN                                        ~15     !1
   41    28    >   ASSIGN_DIM                                               !0, ~4
   51    29        OP_DATA                                                  ~15
   52    30      > RETURN                                                   !0
   53    31*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F4uQCs%3A39%240

Function %00%7Bclosure%7D%2Fin%2F4uQCs%3A44%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uQCs
function name:  {closure}
number of ops:  32
compiled vars:  !0 = $y, !1 = $x, !2 = $c, !3 = $mergeId
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
   46     4        INIT_FCALL                                               'in_array'
          5        FETCH_DIM_R                                      ~4      !1, !0
          6        SEND_VAL                                                 ~4
          7        FETCH_DIM_R                                      ~5      !1, !3
          8        FETCH_DIM_R                                      ~6      !2, ~5
          9        FETCH_DIM_R                                      ~7      ~6, !0
         10        CAST                                          7  ~8      ~7
         11        SEND_VAL                                                 ~8
         12        DO_ICALL                                         $9      
         13      > JMPZ                                                     $9, ->19
   47    14    >   FETCH_DIM_R                                      ~10     !1, !3
         15        FETCH_DIM_R                                      ~11     !2, ~10
         16        FETCH_DIM_R                                      ~12     ~11, !0
         17        QM_ASSIGN                                        ~13     ~12
         18      > JMP                                                      ->30
   48    19    >   INIT_FCALL                                               'array_merge'
         20        FETCH_DIM_R                                      ~14     !1, !3
         21        FETCH_DIM_R                                      ~15     !2, ~14
         22        FETCH_DIM_R                                      ~16     ~15, !0
         23        CAST                                          7  ~17     ~16
         24        SEND_VAL                                                 ~17
         25        FETCH_DIM_R                                      ~18     !1, !0
         26        INIT_ARRAY                                       ~19     ~18
         27        SEND_VAL                                                 ~19
         28        DO_ICALL                                         $20     
         29        QM_ASSIGN                                        ~13     $20
         30    > > RETURN                                                   ~13
   49    31*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F4uQCs%3A44%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.03 ms | 1404 KiB | 27 Q