3v4l.org

run code in 300+ PHP versions simultaneously
<?php function utils_removeDuplicates($str, $delimiter = ',') { if($str != '') { $strArray = explode($delimiter, $str); foreach ($strArray as $value) { $value = trim($value); } $str = implode($delimiter,array_unique($strArray)); } return $str; } $data = "88, 99, 99,99, 100,1 0 0, 88 "; echo utils_removeDuplicates($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v6T8N
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+'
   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 = 25
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 25
filename:       /in/v6T8N
function name:  utils_removeDuplicates
number of ops:  27
compiled vars:  !0 = $str, !1 = $delimiter, !2 = $strArray, !3 = $value
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                                                     ~4, ->25
    4     4    >   INIT_FCALL                                               'explode'
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !2, $5
    5     9      > FE_RESET_R                                       $7      !2, ->16
         10    > > FE_FETCH_R                                               $7, !3, ->16
    6    11    >   INIT_FCALL                                               'trim'
         12        SEND_VAR                                                 !3
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !3, $8
    5    15      > JMP                                                      ->10
         16    >   FE_FREE                                                  $7
    8    17        INIT_FCALL                                               'implode'
         18        SEND_VAR                                                 !1
         19        INIT_FCALL                                               'array_unique'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $10     
         22        SEND_VAR                                                 $10
         23        DO_ICALL                                         $11     
         24        ASSIGN                                                   !0, $11
   11    25    > > RETURN                                                   !0
   12    26*     > RETURN                                                   null

End of function utils_removeduplicates

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.74 ms | 1399 KiB | 22 Q