3v4l.org

run code in 300+ PHP versions simultaneously
<?php function utils_removeDuplicates($str, $delimiter = ',') { if($str != '') { $strArray = explode($delimiter, $str); foreach ($strArray as $key => $value) { $strArray[$key] = trim($value); } $str = implode($delimiter,array_unique($strArray)); } return $str; } $data = "88, 99, 99,99, 100,1 0 0, 88 , 43"; echo utils_removeDuplicates($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/69FQb
function name:  (null)
number of ops:  6
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, '88%2C+99%2C+99%2C99%2C+100%2C1+0+0%2C+88++++%2C+43'
   14     1        INIT_FCALL                                               'utils_removeduplicates'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function utils_removeduplicates:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 27
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 27
filename:       /in/69FQb
function name:  utils_removeDuplicates
number of ops:  29
compiled vars:  !0 = $str, !1 = $delimiter, !2 = $strArray, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      '%2C'
    3     2        IS_NOT_EQUAL                                             !0, ''
          3      > JMPZ                                                     ~5, ->27
    4     4    >   INIT_FCALL                                               'explode'
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !2, $6
    5     9      > FE_RESET_R                                       $8      !2, ->18
         10    > > FE_FETCH_R                                       ~9      $8, !3, ->18
         11    >   ASSIGN                                                   !4, ~9
    6    12        INIT_FCALL                                               'trim'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $12     
         15        ASSIGN_DIM                                               !2, !4
         16        OP_DATA                                                  $12
    5    17      > JMP                                                      ->10
         18    >   FE_FREE                                                  $8
    8    19        INIT_FCALL                                               'implode'
         20        SEND_VAR                                                 !1
         21        INIT_FCALL                                               'array_unique'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $13     
         24        SEND_VAR                                                 $13
         25        DO_ICALL                                         $14     
         26        ASSIGN                                                   !0, $14
   11    27    > > RETURN                                                   !0
   12    28*     > RETURN                                                   null

End of function utils_removeduplicates

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.94 ms | 1403 KiB | 22 Q