3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( array('Status' => 'OK', 'Productname' => 'test1'), array('Status' => 'OK', 'Productname' => 'test1'), array('Status' => 'OK', 'Productname' => 'test2'), array('Status' => 'OK', 'Productname' => 'test2') ); $uniq_name = 'test1'; $key = 'Productname'; $b = array(); $uniq = array(); array_walk($a, function($a) use (&$b,$key,$uniq_name,&$uniq) { $name = $a[$key]; if ($name !== $uniq_name || $b[$name]++ == 0) $uniq[] = $a; }); print_r($uniq);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RQ7eh
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a, !1 = $uniq_name, !2 = $key, !3 = $b, !4 = $uniq
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, 'test1'
   12     2        ASSIGN                                                   !2, 'Productname'
   13     3        ASSIGN                                                   !3, <array>
   14     4        ASSIGN                                                   !4, <array>
   16     5        INIT_FCALL                                               'array_walk'
          6        SEND_REF                                                 !0
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FRQ7eh%3A16%240'
          8        BIND_LEXICAL                                             ~10, !3
          9        BIND_LEXICAL                                             ~10, !2
         10        BIND_LEXICAL                                             ~10, !1
         11        BIND_LEXICAL                                             ~10, !4
   19    12        SEND_VAL                                                 ~10
         13        DO_ICALL                                                 
   20    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !4
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FRQ7eh%3A16%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 13
filename:       /in/RQ7eh
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $a, !1 = $b, !2 = $key, !3 = $uniq_name, !4 = $uniq, !5 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
          4        BIND_STATIC                                              !4
   17     5        FETCH_DIM_R                                      ~6      !0, !2
          6        ASSIGN                                                   !5, ~6
   18     7        IS_NOT_IDENTICAL                                 ~8      !5, !3
          8      > JMPNZ_EX                                         ~8      ~8, ->13
          9    >   FETCH_DIM_RW                                     $9      !1, !5
         10        POST_INC                                         ~10     $9
         11        IS_EQUAL                                         ~11     ~10, 0
         12        BOOL                                             ~8      ~11
         13    > > JMPZ                                                     ~8, ->16
         14    >   ASSIGN_DIM                                               !4
         15        OP_DATA                                                  !0
   19    16    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FRQ7eh%3A16%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.36 ms | 1400 KiB | 17 Q