3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ["444", "0081"], ["449", "0081"], ["451", "0081"], ["455", "2100"], ["469", "2100"] ]; var_export( array_values( array_reduce( $array, function($result, $row) { if (!isset($result[$row[1]])) { $result[$row[1]] = $row; // first occurrence of group, save whole row } else { $result[$row[1]][0] .= ',' . $row[0]; // not first occurrence, concat first element in group } return $result; } ) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MEpHD
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'var_export'
   11     2        INIT_FCALL                                               'array_values'
   12     3        INIT_FCALL                                               'array_reduce'
   13     4        SEND_VAR                                                 !0
   14     5        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   21     6        SEND_VAL                                                 ~2
   12     7        DO_ICALL                                         $3      
   21     8        SEND_VAR                                                 $3
   11     9        DO_ICALL                                         $4      
   21    10        SEND_VAR                                                 $4
   10    11        DO_ICALL                                                 
   24    12      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MEpHD
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $result, !1 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   15     2        FETCH_DIM_R                                      ~2      !1, 1
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      !0, ~2
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->10
   16     6    >   FETCH_DIM_R                                      ~5      !1, 1
          7        ASSIGN_DIM                                               !0, ~5
          8        OP_DATA                                                  !1
   15     9      > JMP                                                      ->16
   18    10    >   FETCH_DIM_R                                      ~7      !1, 1
         11        FETCH_DIM_R                                      ~10     !1, 0
         12        CONCAT                                           ~11     '%2C', ~10
         13        FETCH_DIM_RW                                     $8      !0, ~7
         14        ASSIGN_DIM_OP                .=               8          $8, 0
         15        OP_DATA                                                  ~11
   20    16    > > RETURN                                                   !0
   21    17*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.59 ms | 1008 KiB | 16 Q