3v4l.org

run code in 300+ PHP versions simultaneously
<?php function multiexplode ($delimiters,$string) { $ary = explode($delimiters[0],$string); array_shift($delimiters); if($delimiters != NULL) { foreach($ary as $key => $val) { $ary[$key] = multiexplode($delimiters, $val); } } return $ary; } $string = "Deri Renk|kırmızı-siyah-beyaz-sarı-lacivert,kadife Renk|kırmızı-sarı"; $delimiters = Array(",",":","|","-"); $res = multiexplode($delimiters,$string); Var_dump($res); foreach ($res as $sub) { Foreach($sub[0] as $key => $item){ If($key == 0){ Echo " "; } Foreach($item as $val){ echo $val . "\n"; } } };
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 28
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 28
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 26
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 26
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 24
Branch analysis from position: 19
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 26
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/sg4AR
function name:  (null)
number of ops:  30
compiled vars:  !0 = $string, !1 = $delimiters, !2 = $res, !3 = $sub, !4 = $item, !5 = $key, !6 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, 'Deri+Renk%7Ck%C4%B1rm%C4%B1z%C4%B1-siyah-beyaz-sar%C4%B1-lacivert%2Ckadife+Renk%7Ck%C4%B1rm%C4%B1z%C4%B1-sar%C4%B1'
   15     1        ASSIGN                                                   !1, <array>
   17     2        INIT_FCALL                                               'multiexplode'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $9      
          6        ASSIGN                                                   !2, $9
   18     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
   19    10      > FE_RESET_R                                       $12     !2, ->28
         11    > > FE_FETCH_R                                               $12, !3, ->28
   20    12    >   FETCH_DIM_R                                      ~13     !3, 0
         13      > FE_RESET_R                                       $14     ~13, ->26
         14    > > FE_FETCH_R                                       ~15     $14, !4, ->26
         15    >   ASSIGN                                                   !5, ~15
   21    16        IS_EQUAL                                                 !5, 0
         17      > JMPZ                                                     ~17, ->19
   22    18    >   ECHO                                                     '++'
   24    19    > > FE_RESET_R                                       $18     !4, ->24
         20    > > FE_FETCH_R                                               $18, !6, ->24
   25    21    >   CONCAT                                           ~19     !6, '%0A'
         22        ECHO                                                     ~19
   24    23      > JMP                                                      ->20
         24    >   FE_FREE                                                  $18
   20    25      > JMP                                                      ->14
         26    >   FE_FREE                                                  $14
   19    27      > JMP                                                      ->11
         28    >   FE_FREE                                                  $12
   28    29      > RETURN                                                   1

Function multiexplode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 24
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 24
filename:       /in/sg4AR
function name:  multiexplode
number of ops:  26
compiled vars:  !0 = $delimiters, !1 = $string, !2 = $ary, !3 = $val, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'explode'
          3        FETCH_DIM_R                                      ~5      !0, 0
          4        SEND_VAL                                                 ~5
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !2, $6
    5     8        INIT_FCALL                                               'array_shift'
          9        SEND_REF                                                 !0
         10        DO_ICALL                                                 
    6    11        IS_NOT_EQUAL                                             !0, null
         12      > JMPZ                                                     ~9, ->24
    7    13    > > FE_RESET_R                                       $10     !2, ->23
         14    > > FE_FETCH_R                                       ~11     $10, !3, ->23
         15    >   ASSIGN                                                   !4, ~11
    8    16        INIT_FCALL_BY_NAME                                       'multiexplode'
         17        SEND_VAR_EX                                              !0
         18        SEND_VAR_EX                                              !3
         19        DO_FCALL                                      0  $14     
         20        ASSIGN_DIM                                               !2, !4
         21        OP_DATA                                                  $14
    7    22      > JMP                                                      ->14
         23    >   FE_FREE                                                  $10
   11    24    > > RETURN                                                   !2
   12    25*     > RETURN                                                   null

End of function multiexplode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.18 ms | 1020 KiB | 17 Q