3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myString = "type:blue, type:red, shift:second, shift:first, category:circle, system:unknown"; $params = explode( ", ", $myString ); $possibleKeys = [ "category", "shift", "type", "chances" ]; $ignore = ['system']; $nodes = []; foreach ($params as $param) { $node = explode( ":", $param ); if (in_array( $node[0], $possibleKeys )) { $nodes[$node[0]][] = $node[1]; } else { $nodes[$node[0]] = $node[1]; } } foreach($ignore as $key) { unset($nodes[$key]); } print '<pre>'; print_r($nodes); print '</pre>'; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 33
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 33
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 28
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 33
2 jumps found. (Code = 77) Position 1 = 35, Position 2 = 38
Branch analysis from position: 35
2 jumps found. (Code = 78) Position 1 = 36, Position 2 = 38
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Branch analysis from position: 33
filename:       /in/Udav9
function name:  (null)
number of ops:  45
compiled vars:  !0 = $myString, !1 = $params, !2 = $possibleKeys, !3 = $ignore, !4 = $nodes, !5 = $param, !6 = $node, !7 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'type%3Ablue%2C+type%3Ared%2C+shift%3Asecond%2C+shift%3Afirst%2C+category%3Acircle%2C+system%3Aunknown'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2C+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !1, $9
    5     6        ASSIGN                                                   !2, <array>
    6     7        ASSIGN                                                   !3, <array>
    8     8        ASSIGN                                                   !4, <array>
    9     9      > FE_RESET_R                                       $14     !1, ->33
         10    > > FE_FETCH_R                                               $14, !5, ->33
   10    11    >   INIT_FCALL                                               'explode'
         12        SEND_VAL                                                 '%3A'
         13        SEND_VAR                                                 !5
         14        DO_ICALL                                         $15     
         15        ASSIGN                                                   !6, $15
   11    16        INIT_FCALL                                               'in_array'
         17        FETCH_DIM_R                                      ~17     !6, 0
         18        SEND_VAL                                                 ~17
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $18     
         21      > JMPZ                                                     $18, ->28
   12    22    >   FETCH_DIM_R                                      ~19     !6, 0
         23        FETCH_DIM_R                                      ~22     !6, 1
         24        FETCH_DIM_W                                      $20     !4, ~19
         25        ASSIGN_DIM                                               $20
         26        OP_DATA                                                  ~22
   11    27      > JMP                                                      ->32
   14    28    >   FETCH_DIM_R                                      ~23     !6, 0
         29        FETCH_DIM_R                                      ~25     !6, 1
         30        ASSIGN_DIM                                               !4, ~23
         31        OP_DATA                                                  ~25
    9    32    > > JMP                                                      ->10
         33    >   FE_FREE                                                  $14
   18    34      > FE_RESET_R                                       $26     !3, ->38
         35    > > FE_FETCH_R                                               $26, !7, ->38
   19    36    >   UNSET_DIM                                                !4, !7
   18    37      > JMP                                                      ->35
         38    >   FE_FREE                                                  $26
   22    39        ECHO                                                     '%3Cpre%3E'
   23    40        INIT_FCALL                                               'print_r'
         41        SEND_VAR                                                 !4
         42        DO_ICALL                                                 
   24    43        ECHO                                                     '%3C%2Fpre%3E'
   25    44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.01 ms | 1017 KiB | 16 Q