3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "cat:others;id:4,9,13", "id:4,9,13;cat:electric-products", "id:4,9,13;cat:foods", "cat:drinks,foods" ]; $count = preg_match_all( '/(?:^|;)(id|cat):|\G(?!^),?([^,;]+)/', implode(';', $strings), $matches, PREG_UNMATCHED_AS_NULL ); $cat = []; $id = []; for ($i = 0; $i < $count; ++$i) { if ($matches[1][$i] !== null) { $arrayName = $matches[1][$i]; } else { ${$arrayName}[$matches[2][$i]] = $matches[2][$i]; } } var_export(array_values($id)); echo "\n---\n"; var_export(array_values($cat));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 16
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 16
Branch analysis from position: 34
Branch analysis from position: 16
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 16
Branch analysis from position: 34
Branch analysis from position: 16
filename:       /in/huZClk
function name:  (null)
number of ops:  48
compiled vars:  !0 = $strings, !1 = $count, !2 = $matches, !3 = $cat, !4 = $id, !5 = $i, !6 = $arrayName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'preg_match_all'
   11     2        SEND_VAL                                                 '%2F%28%3F%3A%5E%7C%3B%29%28id%7Ccat%29%3A%7C%5CG%28%3F%21%5E%29%2C%3F%28%5B%5E%2C%3B%5D%2B%29%2F'
   12     3        INIT_FCALL                                               'implode'
          4        SEND_VAL                                                 '%3B'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $8      
          7        SEND_VAR                                                 $8
   13     8        SEND_REF                                                 !2
   14     9        SEND_VAL                                                 512
   10    10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !1, $9
   17    12        ASSIGN                                                   !3, <array>
   18    13        ASSIGN                                                   !4, <array>
   19    14        ASSIGN                                                   !5, 0
         15      > JMP                                                      ->32
   20    16    >   FETCH_DIM_R                                      ~14     !2, 1
         17        FETCH_DIM_R                                      ~15     ~14, !5
         18        TYPE_CHECK                                  1020          ~15
         19      > JMPZ                                                     ~16, ->24
   21    20    >   FETCH_DIM_R                                      ~17     !2, 1
         21        FETCH_DIM_R                                      ~18     ~17, !5
         22        ASSIGN                                                   !6, ~18
   20    23      > JMP                                                      ->31
   23    24    >   FETCH_DIM_R                                      ~21     !2, 2
         25        FETCH_DIM_R                                      ~22     ~21, !5
         26        FETCH_DIM_R                                      ~24     !2, 2
         27        FETCH_DIM_R                                      ~25     ~24, !5
         28        FETCH_W                      local               $20     !6
         29        ASSIGN_DIM                                               $20, ~22
         30        OP_DATA                                                  ~25
   19    31    >   PRE_INC                                                  !5
         32    >   IS_SMALLER                                               !5, !1
         33      > JMPNZ                                                    ~27, ->16
   26    34    >   INIT_FCALL                                               'var_export'
         35        INIT_FCALL                                               'array_values'
         36        SEND_VAR                                                 !4
         37        DO_ICALL                                         $28     
         38        SEND_VAR                                                 $28
         39        DO_ICALL                                                 
   27    40        ECHO                                                     '%0A---%0A'
   28    41        INIT_FCALL                                               'var_export'
         42        INIT_FCALL                                               'array_values'
         43        SEND_VAR                                                 !3
         44        DO_ICALL                                         $30     
         45        SEND_VAR                                                 $30
         46        DO_ICALL                                                 
         47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.49 ms | 1022 KiB | 18 Q