3v4l.org

run code in 500+ PHP versions simultaneously
<?php $ar = []; $ar[0]['name'] = 'Ted'; $ar[1]['name'] = 'Red'; $ar[2]['name'] = 'Ted'; $res_ar = []; $ar_names = []; foreach($ar as $ind => $row){ if (in_array($row['name'],$ar_names)){ array_splice($ar,$ind,1); } else { $ar_names[] = $row['name']; $res_ar[] = $row; } } print_r($res_ar);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 30
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 30
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/JR52I
function name:  (null)
number of ops:  35
compiled vars:  !0 = $ar, !1 = $res_ar, !2 = $ar_names, !3 = $row, !4 = $ind
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        FETCH_DIM_W                                          $6      !0, 0
          2        ASSIGN_DIM                                                   $6, 'name'
          3        OP_DATA                                                      'Ted'
    5     4        FETCH_DIM_W                                          $8      !0, 1
          5        ASSIGN_DIM                                                   $8, 'name'
          6        OP_DATA                                                      'Red'
    6     7        FETCH_DIM_W                                          $10     !0, 2
          8        ASSIGN_DIM                                                   $10, 'name'
          9        OP_DATA                                                      'Ted'
    8    10        ASSIGN                                                       !1, <array>
    9    11        ASSIGN                                                       !2, <array>
   11    12      > FE_RESET_R                                           $14     !0, ->30
         13    > > FE_FETCH_R                                           ~15     $14, !3, ->30
         14    >   ASSIGN                                                       !4, ~15
   12    15        FETCH_DIM_R                                          ~17     !3, 'name'
         16        FRAMELESS_ICALL_2                in_array            ~18     ~17, !2
         17      > JMPZ                                                         ~18, ->24
   13    18    >   INIT_FCALL                                                   'array_splice'
         19        SEND_REF                                                     !0
         20        SEND_VAR                                                     !4
         21        SEND_VAL                                                     1
         22        DO_ICALL                                                     
   12    23      > JMP                                                          ->29
   15    24    >   FETCH_DIM_R                                          ~21     !3, 'name'
         25        ASSIGN_DIM                                                   !2
         26        OP_DATA                                                      ~21
   16    27        ASSIGN_DIM                                                   !1
         28        OP_DATA                                                      !3
   11    29    > > JMP                                                          ->13
         30    >   FE_FREE                                                      $14
   20    31        INIT_FCALL                                                   'print_r'
         32        SEND_VAR                                                     !1
         33        DO_ICALL                                                     
         34      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.53 ms | 2121 KiB | 15 Q