3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array( 'id' => 29, 'name' => 'john' ), array( 'id' => 30, 'name' => 'joe' ), array( 'id' => 29, 'name' => 'jake' ) ); $filter = []; $array = array_filter($array, function($a) use (&$filter) { $ret = !isset($filter[$a['id']]); $filter[$a['id']] = true; return $ret; }); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jo5AL
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array, !1 = $filter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   19     1        ASSIGN                                                   !1, <array>
   20     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !1
   25     6        SEND_VAL                                                 ~4
   20     7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !0, $5
   27     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > 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/Jo5AL
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $a, !1 = $filter, !2 = $ret
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   21     2        FETCH_DIM_R                                      ~3      !0, 'id'
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      !1, ~3
          4        BOOL_NOT                                         ~5      ~4
          5        ASSIGN                                                   !2, ~5
   22     6        FETCH_DIM_R                                      ~7      !0, 'id'
          7        ASSIGN_DIM                                               !1, ~7
          8        OP_DATA                                                  <true>
   24     9      > RETURN                                                   !2
   25    10*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.97 ms | 1070 KiB | 15 Q