3v4l.org

run code in 500+ 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 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 13
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 13
Branch analysis from position: 31
Branch analysis from position: 13
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 13
Branch analysis from position: 31
Branch analysis from position: 13
filename:       /in/huZClk
function name:  (null)
number of ops:  45
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        FRAMELESS_ICALL_2                implode             ~8      '%3B', !0
          4        SEND_VAL                                                     ~8
   13     5        SEND_REF                                                     !2
   14     6        SEND_VAL                                                     512
   10     7        DO_ICALL                                             $9      
          8        ASSIGN                                                       !1, $9
   17     9        ASSIGN                                                       !3, <array>
   18    10        ASSIGN                                                       !4, <array>
   19    11        ASSIGN                                                       !5, 0
         12      > JMP                                                          ->29
   20    13    >   FETCH_DIM_R                                          ~14     !2, 1
         14        FETCH_DIM_R                                          ~15     ~14, !5
         15        TYPE_CHECK                                      1020          ~15
         16      > JMPZ                                                         ~16, ->21
   21    17    >   FETCH_DIM_R                                          ~17     !2, 1
         18        FETCH_DIM_R                                          ~18     ~17, !5
         19        ASSIGN                                                       !6, ~18
   20    20      > JMP                                                          ->28
   23    21    >   FETCH_DIM_R                                          ~21     !2, 2
         22        FETCH_DIM_R                                          ~22     ~21, !5
         23        FETCH_DIM_R                                          ~24     !2, 2
         24        FETCH_DIM_R                                          ~25     ~24, !5
         25        FETCH_W                          local               $20     !6
         26        ASSIGN_DIM                                                   $20, ~22
         27        OP_DATA                                                      ~25
   19    28    >   PRE_INC                                                      !5
         29    >   IS_SMALLER                                                   !5, !1
         30      > JMPNZ                                                        ~27, ->13
   26    31    >   INIT_FCALL                                                   'var_export'
         32        INIT_FCALL                                                   'array_values'
         33        SEND_VAR                                                     !4
         34        DO_ICALL                                             $28     
         35        SEND_VAR                                                     $28
         36        DO_ICALL                                                     
   27    37        ECHO                                                         '%0A---%0A'
   28    38        INIT_FCALL                                                   'var_export'
         39        INIT_FCALL                                                   'array_values'
         40        SEND_VAR                                                     !3
         41        DO_ICALL                                             $30     
         42        SEND_VAR                                                     $30
         43        DO_ICALL                                                     
         44      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.8 ms | 2092 KiB | 16 Q