3v4l.org

run code in 300+ PHP versions simultaneously
<?php $attribute_options_string = "Spice (Very Hot/3, Hot/2, Medium/1) | Size(Small,Medium,Large)"; $attribute_options_array = array(); $attributes = preg_split('/\s*\|\s*/', $attribute_options_string); foreach ($attributes as $attribute) { preg_match('/\s*(\w+)\s*\(([^)]+)/', $attribute, $matches); $attribute_name = strtolower($matches[1]); $options = preg_split('/\s*,\s*/', $matches[2]); foreach ($options as $option) { if (strpos($option, '/') !== false) { list($option_name, $option_value) = preg_split('#\s*/\s*#', $option); $attribute_options_array[$attribute_name][strtolower($option_name)] = $option_value; } else { $attribute_options_array[$attribute_name][] = strtolower($option); } } } var_export($attribute_options_array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 58
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 58
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 56
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 56
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 49
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 56
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
filename:       /in/PfaMC
function name:  (null)
number of ops:  63
compiled vars:  !0 = $attribute_options_string, !1 = $attribute_options_array, !2 = $attributes, !3 = $attribute, !4 = $matches, !5 = $attribute_name, !6 = $options, !7 = $option, !8 = $option_name, !9 = $option_value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Spice+%28Very+Hot%2F3%2C+Hot%2F2%2C+Medium%2F1%29+%7C+Size%28Small%2CMedium%2CLarge%29'
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'preg_split'
          3        SEND_VAL                                                 '%2F%5Cs%2A%5C%7C%5Cs%2A%2F'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $12     
          6        ASSIGN                                                   !2, $12
    6     7      > FE_RESET_R                                       $14     !2, ->58
          8    > > FE_FETCH_R                                               $14, !3, ->58
    7     9    >   INIT_FCALL                                               'preg_match'
         10        SEND_VAL                                                 '%2F%5Cs%2A%28%5Cw%2B%29%5Cs%2A%5C%28%28%5B%5E%29%5D%2B%29%2F'
         11        SEND_VAR                                                 !3
         12        SEND_REF                                                 !4
         13        DO_ICALL                                                 
    8    14        INIT_FCALL                                               'strtolower'
         15        FETCH_DIM_R                                      ~16     !4, 1
         16        SEND_VAL                                                 ~16
         17        DO_ICALL                                         $17     
         18        ASSIGN                                                   !5, $17
    9    19        INIT_FCALL                                               'preg_split'
         20        SEND_VAL                                                 '%2F%5Cs%2A%2C%5Cs%2A%2F'
         21        FETCH_DIM_R                                      ~19     !4, 2
         22        SEND_VAL                                                 ~19
         23        DO_ICALL                                         $20     
         24        ASSIGN                                                   !6, $20
   10    25      > FE_RESET_R                                       $22     !6, ->56
         26    > > FE_FETCH_R                                               $22, !7, ->56
   11    27    >   INIT_FCALL                                               'strpos'
         28        SEND_VAR                                                 !7
         29        SEND_VAL                                                 '%2F'
         30        DO_ICALL                                         $23     
         31        TYPE_CHECK                                  1018          $23
         32      > JMPZ                                                     ~24, ->49
   12    33    >   INIT_FCALL                                               'preg_split'
         34        SEND_VAL                                                 '%23%5Cs%2A%2F%5Cs%2A%23'
         35        SEND_VAR                                                 !7
         36        DO_ICALL                                         $25     
         37        FETCH_LIST_R                                     $26     $25, 0
         38        ASSIGN                                                   !8, $26
         39        FETCH_LIST_R                                     $28     $25, 1
         40        ASSIGN                                                   !9, $28
         41        FREE                                                     $25
   13    42        INIT_FCALL                                               'strtolower'
         43        SEND_VAR                                                 !8
         44        DO_ICALL                                         $31     
         45        FETCH_DIM_W                                      $30     !1, !5
         46        ASSIGN_DIM                                               $30, $31
         47        OP_DATA                                                  !9
   11    48      > JMP                                                      ->55
   16    49    >   INIT_FCALL                                               'strtolower'
         50        SEND_VAR                                                 !7
         51        DO_ICALL                                         $35     
         52        FETCH_DIM_W                                      $33     !1, !5
         53        ASSIGN_DIM                                               $33
         54        OP_DATA                                                  $35
   10    55    > > JMP                                                      ->26
         56    >   FE_FREE                                                  $22
    6    57      > JMP                                                      ->8
         58    >   FE_FREE                                                  $14
   20    59        INIT_FCALL                                               'var_export'
         60        SEND_VAR                                                 !1
         61        DO_ICALL                                                 
         62      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.05 ms | 1007 KiB | 18 Q