3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array("Item1.10", "Item2.5", "Item3.0", "Item2.2", "Item4.50", "Item2.50"); $tempArray = array(); $newArray = array(); foreach($array as $value) { $item = explode(".", $value); if(!in_array($item[0], $tempArray)) { $newArray[] = $value; $tempArray[] = $item; } } print_r($newArray);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 22
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 21
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/rCGG9
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array, !1 = $tempArray, !2 = $newArray, !3 = $value, !4 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     3      > FE_RESET_R                                       $8      !0, ->22
          4    > > FE_FETCH_R                                               $8, !3, ->22
    7     5    >   INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '.'
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $9      
          9        ASSIGN                                                   !4, $9
    8    10        INIT_FCALL                                               'in_array'
         11        FETCH_DIM_R                                      ~11     !4, 0
         12        SEND_VAL                                                 ~11
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $12     
         15        BOOL_NOT                                         ~13     $12
         16      > JMPZ                                                     ~13, ->21
    9    17    >   ASSIGN_DIM                                               !2
         18        OP_DATA                                                  !3
   10    19        ASSIGN_DIM                                               !1
         20        OP_DATA                                                  !4
    6    21    > > JMP                                                      ->4
         22    >   FE_FREE                                                  $8
   13    23        INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.82 ms | 1396 KiB | 19 Q