3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ [ 'id' => 1, 'email_id' => 'ok@gmail.com', 'password' => 'test' ], [ 'id' => 2, 'email_id' => 'check@gmail.com', 'password' => 'test' ], [ 'id' => 3, 'email_id' => 'an@gmail.com', 'password' => 'pass' ] ]; var_export( array_values( array_reduce( $array, function($result, $row) { if (!isset($result[$row['password']])) { $result[$row['password']] = $row; } else { if (isset($result[$row['password']]['id'])) { $result[$row['password']] = [$result[$row['password']]]; } $result[$row['password']][] = $row; } return $result; }, [] ) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YJEMF
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   21     1        INIT_FCALL                                                   'var_export'
   22     2        INIT_FCALL                                                   'array_values'
   23     3        INIT_FCALL                                                   'array_reduce'
   24     4        SEND_VAR                                                     !0
   25     5        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
   35     6        SEND_VAL                                                     ~2
   36     7        SEND_VAL                                                     <array>
   23     8        DO_ICALL                                             $3      
   36     9        SEND_VAR                                                     $3
   22    10        DO_ICALL                                             $4      
   36    11        SEND_VAR                                                     $4
   21    12        DO_ICALL                                                     
   39    13      > 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 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/YJEMF
function name:  {closure:/in/YJEMF:25}
number of ops:  26
compiled vars:  !0 = $result, !1 = $row
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   26     2        FETCH_DIM_R                                          ~2      !1, 'password'
          3        ISSET_ISEMPTY_DIM_OBJ                             0  ~3      !0, ~2
          4        BOOL_NOT                                             ~4      ~3
          5      > JMPZ                                                         ~4, ->10
   27     6    >   FETCH_DIM_R                                          ~5      !1, 'password'
          7        ASSIGN_DIM                                                   !0, ~5
          8        OP_DATA                                                      !1
   26     9      > JMP                                                          ->24
   29    10    >   FETCH_DIM_R                                          ~7      !1, 'password'
         11        FETCH_DIM_IS                                         ~8      !0, ~7
         12        ISSET_ISEMPTY_DIM_OBJ                             0          ~8, 'id'
         13      > JMPZ                                                         ~9, ->20
   30    14    >   FETCH_DIM_R                                          ~10     !1, 'password'
         15        FETCH_DIM_R                                          ~12     !1, 'password'
         16        FETCH_DIM_R                                          ~13     !0, ~12
         17        INIT_ARRAY                                           ~14     ~13
         18        ASSIGN_DIM                                                   !0, ~10
         19        OP_DATA                                                      ~14
   32    20    >   FETCH_DIM_R                                          ~15     !1, 'password'
         21        FETCH_DIM_W                                          $16     !0, ~15
         22        ASSIGN_DIM                                                   $16
         23        OP_DATA                                                      !1
   34    24    > > RETURN                                                       !0
   35    25*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.83 ms | 2073 KiB | 16 Q