3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '1, 4, 7, 20-25, 31, 46-48, 100'; $array = explode(',', $string); $array = array_map('trim', $array); $array_aux = array(); for ($i = 0; $i < count($array); $i++) { if (!is_numeric($array[$i])) { $new_array = explode('-', $array[$i]); for ($j = $new_array[0]; $j <= $new_array[1]; $j++) { array_splice($array_aux, 0, 0, $j); } unset($array[$i]); } } $array = array_merge($array, $array_aux); rsort($array); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 14
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 40
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 29
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 14
Branch analysis from position: 44
Branch analysis from position: 14
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 29
Branch analysis from position: 39
Branch analysis from position: 29
Branch analysis from position: 40
filename:       /in/F0UV7
function name:  (null)
number of ops:  56
compiled vars:  !0 = $string, !1 = $array, !2 = $array_aux, !3 = $i, !4 = $new_array, !5 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '1%2C+4%2C+7%2C+20-25%2C+31%2C+46-48%2C+100'
    3     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2C'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
    4     6        INIT_FCALL                                               'array_map'
          7        SEND_VAL                                                 'trim'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $9      
         10        ASSIGN                                                   !1, $9
    5    11        ASSIGN                                                   !2, <array>
    6    12        ASSIGN                                                   !3, 0
         13      > JMP                                                      ->41
    7    14    >   INIT_FCALL                                               'is_numeric'
         15        FETCH_DIM_R                                      ~13     !1, !3
         16        SEND_VAL                                                 ~13
         17        DO_ICALL                                         $14     
         18        BOOL_NOT                                         ~15     $14
         19      > JMPZ                                                     ~15, ->40
    8    20    >   INIT_FCALL                                               'explode'
         21        SEND_VAL                                                 '-'
         22        FETCH_DIM_R                                      ~16     !1, !3
         23        SEND_VAL                                                 ~16
         24        DO_ICALL                                         $17     
         25        ASSIGN                                                   !4, $17
   10    26        FETCH_DIM_R                                      ~19     !4, 0
         27        ASSIGN                                                   !5, ~19
         28      > JMP                                                      ->36
   11    29    >   INIT_FCALL                                               'array_splice'
         30        SEND_REF                                                 !2
         31        SEND_VAL                                                 0
         32        SEND_VAL                                                 0
         33        SEND_VAR                                                 !5
         34        DO_ICALL                                                 
   10    35        PRE_INC                                                  !5
         36    >   FETCH_DIM_R                                      ~23     !4, 1
         37        IS_SMALLER_OR_EQUAL                                      !5, ~23
         38      > JMPNZ                                                    ~24, ->29
   14    39    >   UNSET_DIM                                                !1, !3
    6    40    >   PRE_INC                                                  !3
         41    >   COUNT                                            ~26     !1
         42        IS_SMALLER                                               !3, ~26
         43      > JMPNZ                                                    ~27, ->14
   17    44    >   INIT_FCALL                                               'array_merge'
         45        SEND_VAR                                                 !1
         46        SEND_VAR                                                 !2
         47        DO_ICALL                                         $28     
         48        ASSIGN                                                   !1, $28
   19    49        INIT_FCALL                                               'rsort'
         50        SEND_REF                                                 !1
         51        DO_ICALL                                                 
   21    52        INIT_FCALL                                               'print_r'
         53        SEND_VAR                                                 !1
         54        DO_ICALL                                                 
         55      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.26 ms | 1400 KiB | 27 Q