3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "0-1-1-3-1-1-3-5-0"; $array = explode('-', $input); $result = array_unique($array) + array_fill(0, count($array), 0); ksort($result); var_dump(implode('-',$result));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5dCXT
function name:  (null)
number of ops:  28
compiled vars:  !0 = $input, !1 = $array, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '0-1-1-3-1-1-3-5-0'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '-'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    6     6        INIT_FCALL                                               'array_unique'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $6      
          9        INIT_FCALL                                               'array_fill'
         10        SEND_VAL                                                 0
         11        COUNT                                            ~7      !1
         12        SEND_VAL                                                 ~7
         13        SEND_VAL                                                 0
         14        DO_ICALL                                         $8      
         15        ADD                                              ~9      $6, $8
         16        ASSIGN                                                   !2, ~9
    7    17        INIT_FCALL                                               'ksort'
         18        SEND_REF                                                 !2
         19        DO_ICALL                                                 
    9    20        INIT_FCALL                                               'var_dump'
         21        INIT_FCALL                                               'implode'
         22        SEND_VAL                                                 '-'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                         $12     
         25        SEND_VAR                                                 $12
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.68 ms | 1458 KiB | 19 Q