3v4l.org

run code in 300+ PHP versions simultaneously
<?php function utils_removeDuplicates($str, $delimiter = ',') { if($str != '') { $str = implode($delimiter,array_unique(explode($delimiter, $str))); } return $str; } $data = "88, 99, 99,99, 100"; //echo utils_removeDuplicates($data); echo preg_split( '/[, ]+/', $data, -1, PREG_SPLIT_NO_EMPTY );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jHcVT
function name:  (null)
number of ops:  9
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, '88%2C+99%2C+99%2C99%2C+100'
   12     1        INIT_FCALL                                               'preg_split'
          2        SEND_VAL                                                 '%2F%5B%2C+%5D%2B%2F'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 -1
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $2      
          7        ECHO                                                     $2
          8      > RETURN                                                   1

Function utils_removeduplicates:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/jHcVT
function name:  utils_removeDuplicates
number of ops:  18
compiled vars:  !0 = $str, !1 = $delimiter
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                                                     ~2, ->16
    4     4    >   INIT_FCALL                                               'implode'
          5        SEND_VAR                                                 !1
          6        INIT_FCALL                                               'array_unique'
          7        INIT_FCALL                                               'explode'
          8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $3      
         11        SEND_VAR                                                 $3
         12        DO_ICALL                                         $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                         $5      
         15        ASSIGN                                                   !0, $5
    7    16    > > RETURN                                                   !0
    8    17*     > RETURN                                                   null

End of function utils_removeduplicates

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.54 ms | 1388 KiB | 21 Q