3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _prepareSkuParseRules(){ $structure = array(); $skuStructure = "[#name]-[Stoffgruppe]-[Groesse]-[:Ausfuehrung]-[:Matratze]"; $segments = explode("-", $skuStructure); foreach($segments as $segment){ $segmentInfo = array(); //check if segment is fixed if(!preg_match('/^\[(#|:)?([^\]#]*)\]$/', $segment, $matches)){ //is fixed value $segmentInfo["type"] = "provided"; $segmentInfo["namespace"] = "both"; $segmentInfo["value"] = $matches[2]; }else{ if(isset($matches[1]) && !empty($matches[1]) && strcmp($matches[1], "#")==0){ $segmentInfo["type"] = "provided"; $segmentInfo["namespace"] = "both"; //is registered variable name switch($matches[2]){ case "name": $segmentInfo["value"] = "modell"; break; } }else{ if(isset($matches[1]) && !empty($matches[1]) && strcmp($matches[1], ":")==0){ $segmentInfo["namespace"] = "simple"; }else{ $segmentInfo["namespace"] = "both"; } $segmentInfo["type"] = "field"; $segmentInfo["fieldname"] = $matches[2]; } } $structure[] = $segmentInfo; } var_dump($structure); } _prepareSkuParseRules(); echo strtolower("This-is-my-Segmentation-test");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/78cE7
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   INIT_FCALL                                               '_prepareskuparserules'
          1        DO_FCALL                                      0          
   39     2        INIT_FCALL                                               'strtolower'
          3        SEND_VAL                                                 'This-is-my-Segmentation-test'
          4        DO_ICALL                                         $1      
          5        ECHO                                                     $1
          6      > RETURN                                                   1

Function _prepareskuparserules:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 79
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 79
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 25
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 38
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 52
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 47
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
Branch analysis from position: 52
2 jumps found. (Code = 46) Position 1 = 54, Position 2 = 57
Branch analysis from position: 54
2 jumps found. (Code = 46) Position 1 = 58, Position 2 = 65
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 69
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 65
Branch analysis from position: 57
Branch analysis from position: 38
Branch analysis from position: 30
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
filename:       /in/78cE7
function name:  _prepareSkuParseRules
number of ops:  84
compiled vars:  !0 = $structure, !1 = $skuStructure, !2 = $segments, !3 = $segment, !4 = $segmentInfo, !5 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, '%5B%23name%5D-%5BStoffgruppe%5D-%5BGroesse%5D-%5B%3AAusfuehrung%5D-%5B%3AMatratze%5D'
    5     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '-'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !2, $8
    6     7      > FE_RESET_R                                       $10     !2, ->79
          8    > > FE_FETCH_R                                               $10, !3, ->79
    7     9    >   ASSIGN                                                   !4, <array>
    9    10        INIT_FCALL                                               'preg_match'
         11        SEND_VAL                                                 '%2F%5E%5C%5B%28%23%7C%3A%29%3F%28%5B%5E%5C%5D%23%5D%2A%29%5C%5D%24%2F'
         12        SEND_VAR                                                 !3
         13        SEND_REF                                                 !5
         14        DO_ICALL                                         $12     
         15        BOOL_NOT                                         ~13     $12
         16      > JMPZ                                                     ~13, ->25
   11    17    >   ASSIGN_DIM                                               !4, 'type'
         18        OP_DATA                                                  'provided'
   12    19        ASSIGN_DIM                                               !4, 'namespace'
         20        OP_DATA                                                  'both'
   13    21        FETCH_DIM_R                                      ~17     !5, 2
         22        ASSIGN_DIM                                               !4, 'value'
         23        OP_DATA                                                  ~17
         24      > JMP                                                      ->76
   15    25    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~18     !5, 1
         26      > JMPZ_EX                                          ~18     ~18, ->30
         27    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~19     !5, 1
         28        BOOL_NOT                                         ~20     ~19
         29        BOOL                                             ~18     ~20
         30    > > JMPZ_EX                                          ~18     ~18, ->38
         31    >   INIT_FCALL                                               'strcmp'
         32        FETCH_DIM_R                                      ~21     !5, 1
         33        SEND_VAL                                                 ~21
         34        SEND_VAL                                                 '%23'
         35        DO_ICALL                                         $22     
         36        IS_EQUAL                                         ~23     $22, 0
         37        BOOL                                             ~18     ~23
         38    > > JMPZ                                                     ~18, ->52
   16    39    >   ASSIGN_DIM                                               !4, 'type'
         40        OP_DATA                                                  'provided'
   17    41        ASSIGN_DIM                                               !4, 'namespace'
         42        OP_DATA                                                  'both'
   19    43        FETCH_DIM_R                                      ~26     !5, 2
   20    44        CASE                                                     ~26, 'name'
         45      > JMPNZ                                                    ~27, ->47
         46    > > JMP                                                      ->50
         47    >   ASSIGN_DIM                                               !4, 'value'
         48        OP_DATA                                                  'modell'
         49      > JMP                                                      ->50
         50    >   FREE                                                     ~26
         51      > JMP                                                      ->76
   23    52    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~29     !5, 1
         53      > JMPZ_EX                                          ~29     ~29, ->57
         54    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~30     !5, 1
         55        BOOL_NOT                                         ~31     ~30
         56        BOOL                                             ~29     ~31
         57    > > JMPZ_EX                                          ~29     ~29, ->65
         58    >   INIT_FCALL                                               'strcmp'
         59        FETCH_DIM_R                                      ~32     !5, 1
         60        SEND_VAL                                                 ~32
         61        SEND_VAL                                                 '%3A'
         62        DO_ICALL                                         $33     
         63        IS_EQUAL                                         ~34     $33, 0
         64        BOOL                                             ~29     ~34
         65    > > JMPZ                                                     ~29, ->69
   24    66    >   ASSIGN_DIM                                               !4, 'namespace'
         67        OP_DATA                                                  'simple'
         68      > JMP                                                      ->71
   26    69    >   ASSIGN_DIM                                               !4, 'namespace'
         70        OP_DATA                                                  'both'
   28    71    >   ASSIGN_DIM                                               !4, 'type'
         72        OP_DATA                                                  'field'
   29    73        FETCH_DIM_R                                      ~39     !5, 2
         74        ASSIGN_DIM                                               !4, 'fieldname'
         75        OP_DATA                                                  ~39
   32    76    >   ASSIGN_DIM                                               !0
         77        OP_DATA                                                  !4
    6    78      > JMP                                                      ->8
         79    >   FE_FREE                                                  $10
   34    80        INIT_FCALL                                               'var_dump'
         81        SEND_VAR                                                 !0
         82        DO_ICALL                                                 
   35    83      > RETURN                                                   null

End of function _prepareskuparserules

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.78 ms | 1407 KiB | 24 Q