3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array("ItemNew1.10", "Item2.5", "Item2.2", "Item4.50", "Item2.50", "Aluminum and glass windows.0", "Aluminum and glass windows.0"); $tempArray = array(); $newArray = array(); foreach($array as $value) { list($item, ) = explode(".", $value); $int = filter_var($item, FILTER_SANITIZE_NUMBER_INT); if(!in_array($int, $tempArray)) { $newArray[] = $value; $tempArray[] = $int; } } print_r($newArray); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 28
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 28
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 27
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/7CBmH
function name:  (null)
number of ops:  33
compiled vars:  !0 = $array, !1 = $tempArray, !2 = $newArray, !3 = $value, !4 = $item, !5 = $int
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                                       $9      !0, ->28
          4    > > FE_FETCH_R                                               $9, !3, ->28
    7     5    >   INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '.'
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $10     
          9        FETCH_LIST_R                                     $11     $10, 0
         10        ASSIGN                                                   !4, $11
         11        FREE                                                     $10
    8    12        INIT_FCALL                                               'filter_var'
         13        SEND_VAR                                                 !4
         14        SEND_VAL                                                 519
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !5, $13
    9    17        INIT_FCALL                                               'in_array'
         18        SEND_VAR                                                 !5
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $15     
         21        BOOL_NOT                                         ~16     $15
         22      > JMPZ                                                     ~16, ->27
   10    23    >   ASSIGN_DIM                                               !2
         24        OP_DATA                                                  !3
   11    25        ASSIGN_DIM                                               !1
         26        OP_DATA                                                  !5
    6    27    > > JMP                                                      ->4
         28    >   FE_FREE                                                  $9
   14    29        INIT_FCALL                                               'print_r'
         30        SEND_VAR                                                 !2
         31        DO_ICALL                                                 
   15    32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.48 ms | 1388 KiB | 21 Q